Add Dockerfile
This commit is contained in:
parent
bdf2940e7b
commit
95216371d3
20
Dockerfile
20
Dockerfile
|
@ -1,11 +1,21 @@
|
||||||
|
# Build Stage
|
||||||
FROM node:20-slim as builder
|
FROM node:20-slim as builder
|
||||||
WORKDIR /usr/src/app
|
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
|
FROM node:20-slim
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Copy only the built application and production dependencies
|
||||||
COPY --from=builder /usr/src/app/ /usr/src/app/
|
COPY --from=builder /usr/src/app/ /usr/src/app/
|
||||||
COPY . .
|
RUN npm prune --production
|
||||||
CMD ["npx", "@11ty/eleventy", "--serve", "--port", "3000"]
|
|
||||||
|
# Default command to run Eleventy in serve mode
|
||||||
|
CMD ["npx", "@11ty/eleventy", "--serve", "--port", "4000"]
|
||||||
|
|
Loading…
Reference in New Issue