docker: switch to runtime-only image using prebuilt dist/server-dist; no TS build in image
This commit is contained in:
37
Dockerfile
37
Dockerfile
@@ -1,25 +1,3 @@
|
||||
# Multi-stage build for production
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
# Install pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
RUN pnpm build
|
||||
|
||||
# Production stage
|
||||
FROM node:22-alpine AS production
|
||||
|
||||
# Install pnpm and required runtime tools
|
||||
@@ -34,17 +12,12 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
# Install production dependencies only
|
||||
RUN pnpm install --frozen-lockfile --prod
|
||||
|
||||
# Copy built application from base stage
|
||||
COPY --from=base /app/dist ./dist
|
||||
COPY --from=base /app/server-dist ./server-dist
|
||||
COPY --from=base /app/public ./public
|
||||
# Copy prebuilt application artifacts from repository (no TS build in image)
|
||||
COPY dist ./dist
|
||||
COPY server-dist ./server-dist
|
||||
COPY public ./public
|
||||
|
||||
# Copy necessary files for runtime
|
||||
COPY --from=base /app/src/server/index.ts ./src/server/index.ts
|
||||
COPY --from=base /app/src/server/routes ./src/server/routes
|
||||
COPY --from=base /app/src/server/rpc ./src/server/rpc
|
||||
COPY --from=base /app/src/server/lib ./src/server/lib
|
||||
COPY --from=base /app/tsconfig.server.json ./tsconfig.server.json
|
||||
# Copy necessary runtime files
|
||||
COPY start.sh ./start.sh
|
||||
|
||||
# Create non-root user for security
|
||||
|
Reference in New Issue
Block a user