Add Dockerfile

This commit is contained in:
Gal 2024-11-21 19:07:56 +01:00
parent bdf2940e7b
commit 95216371d3
Signed by: gal
GPG Key ID: F035BC65003BC00B
1 changed files with 15 additions and 5 deletions

View File

@ -1,11 +1,21 @@
# Build Stage
FROM node:20-slim as builder
WORKDIR /usr/src/app
COPY package.json .
RUN npm ci
RUN npm install
# 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/
COPY . .
CMD ["npx", "@11ty/eleventy", "--serve", "--port", "3000"]
RUN npm prune --production
# Default command to run Eleventy in serve mode
CMD ["npx", "@11ty/eleventy", "--serve", "--port", "4000"]