feat: dickerization
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
# Stage 1: Build the application
|
||||
FROM node:24-slim AS builder
|
||||
|
||||
# Enable corepack to use pnpm
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy configuration files
|
||||
COPY package.json pnpm-lock.yaml .npmrc ./
|
||||
|
||||
# Install all dependencies (including devDependencies)
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy the rest of the application code
|
||||
COPY . .
|
||||
|
||||
# Build the SvelteKit application
|
||||
RUN pnpm run build
|
||||
|
||||
# Stage 2: Run the application
|
||||
FROM node:24-slim AS runner
|
||||
|
||||
# Enable corepack to use pnpm
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the build output and necessary files for production
|
||||
COPY --from=builder /app/build ./build
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
COPY --from=builder /app/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||
COPY --from=builder /app/.npmrc ./.npmrc
|
||||
|
||||
# Install only production dependencies
|
||||
RUN pnpm install --prod --frozen-lockfile
|
||||
|
||||
# Expose the port the app runs on (SvelteKit defaults to 3000)
|
||||
EXPOSE 3000
|
||||
|
||||
# Set environment variables
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Run the application
|
||||
CMD ["node", "build"]
|
||||
Reference in New Issue
Block a user