32 lines
566 B
Docker
32 lines
566 B
Docker
# --- Build Aşaması ---
|
||
FROM node:20-alpine AS builder
|
||
|
||
WORKDIR /usr/src/app
|
||
|
||
COPY ServicesApi/package*.json ./
|
||
|
||
RUN npm install -g npm@latest
|
||
RUN npm ci --legacy-peer-deps
|
||
|
||
COPY ServicesApi .
|
||
|
||
RUN npm run build
|
||
|
||
# --- Prod Image ---
|
||
FROM node:20-alpine AS production
|
||
|
||
WORKDIR /usr/src/app
|
||
ENV NODE_ENV=production
|
||
|
||
COPY --from=builder /usr/src/app/dist ./dist
|
||
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
||
COPY --from=builder /usr/src/app/package.json ./package.json
|
||
|
||
RUN npm prune --production
|
||
|
||
USER node
|
||
|
||
EXPOSE 3000
|
||
|
||
CMD ["node", "dist/main.js"]
|