personal-homepage/Dockerfile

22 lines
503 B
Docker

# Build Stage
FROM node:20-slim as builder
WORKDIR /usr/src/app
# Copy dependency files first for caching
COPY package.json package-lock.json ./
RUN npm ci
# Copy the rest of the source files
COPY . .
# Final Stage
FROM node:20-slim
WORKDIR /usr/src/app
# Copy only the built application and production dependencies
COPY --from=builder /usr/src/app/ /usr/src/app/
RUN npm prune --production
# Default command to run Eleventy in serve mode
CMD ["npx", "@11ty/eleventy", "--serve", "--port", "4000"]