21 lines
460 B
Docker
21 lines
460 B
Docker
# Build stage
|
|
FROM node:18-alpine AS build
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Artifacts stage (per estrarre i build artifacts)
|
|
FROM build AS artifacts
|
|
RUN mkdir -p /out/dist && cp -r dist/* /out/dist/
|
|
|
|
# Production stage
|
|
FROM node:18-alpine AS production
|
|
WORKDIR /app
|
|
COPY --from=build /app/dist ./dist
|
|
COPY --from=build /app/package*.json ./
|
|
RUN npm install --production
|
|
EXPOSE 3000
|
|
CMD ["node", "dist/index.js"]
|