resume/Dockerfile
christian 1c7122cac9
All checks were successful
Build and Push Docker Image / build (push) Successful in 23s
dockerfile
2025-05-06 00:26:10 +02:00

48 lines
761 B
Docker

FROM node:22-alpine AS builder
# Install pnpm
RUN npm install -g pnpm
WORKDIR /app
# Copy pnpm specific files
COPY pnpm-lock.yaml package.json ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy the rest of the application
COPY . .
# Build the application
RUN pnpm build
# Production stage
FROM node:22-alpine AS runtime
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install production dependencies only
RUN pnpm install --prod --frozen-lockfile && \
rm -rf /root/.npm /root/.pnpm-store
# Copy built application from builder stage
COPY --from=builder /app/build ./build
# Use non-root user
USER node
EXPOSE 3000
ENV NODE_ENV=production
CMD ["node", "build"]