mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-28 18:28:02 +08:00
chore: update dockerfile
This commit is contained in:
@@ -1,22 +1,41 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node:20.12.0 AS builder
|
||||
# Build stage
|
||||
FROM node:20.12.0-alpine AS builder
|
||||
|
||||
# Set production environment
|
||||
ENV NODE_ENV=production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ARG VERSION=main
|
||||
# Copy package files first for better layer caching
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Enable corepack and install dependencies
|
||||
RUN corepack enable && \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
RUN corepack enable
|
||||
RUN pnpm install
|
||||
|
||||
# Build without environment variables - they will be injected at runtime
|
||||
# Build the application
|
||||
RUN pnpm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
# Production stage
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk add --no-cache tini
|
||||
|
||||
# Copy built application
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html/
|
||||
|
||||
# Copy configuration files
|
||||
COPY --from=builder /app/docker/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=builder /app/docker/entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
# Make entrypoint executable
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# Set the entrypoint
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
# Use tini to handle signals properly
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/docker-entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user