adds deployment scripts
This commit is contained in:
parent
e4ee90d7cd
commit
0c2e34bb61
3 changed files with 50 additions and 9 deletions
27
Dockerfile
27
Dockerfile
|
|
@ -1,19 +1,28 @@
|
|||
# Use a Node.js Alpine image for the builder stage
|
||||
# Builder stage
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
|
||||
# Install deps for build
|
||||
COPY package*.json .
|
||||
RUN npm ci
|
||||
|
||||
# Copy source and build
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
# Use another Node.js Alpine image for the final stage
|
||||
|
||||
# Final image
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/build build/
|
||||
COPY --from=builder /app/node_modules node_modules/
|
||||
COPY package.json .
|
||||
|
||||
# Copy only what's needed for runtime
|
||||
COPY package.json ./
|
||||
COPY --from=builder /app/build ./build/
|
||||
COPY --from=builder /app/node_modules ./node_modules/
|
||||
|
||||
# Prune dev dependencies
|
||||
RUN npm prune --production
|
||||
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
CMD [ "node", "build" ]
|
||||
|
||||
CMD ["node", "build"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue