Skip to content

Commit

Permalink
Merge pull request #1 from Mogyuchi/fix-dockerfile
Browse files Browse the repository at this point in the history
fix Dockerfile
  • Loading branch information
cm-ayf authored Oct 23, 2023
2 parents 3492d6d + eeee00a commit 1bf7d6e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
FROM node:18 as builder
# syntax=docker/dockerfile:1

FROM node:18 AS deps
ARG NODE_ENV=production
WORKDIR /app
COPY ./package*.json ./
RUN npm ci

COPY ./* ./

RUN npm install
FROM node:18 AS builder
ARG NODE_ENV=development
WORKDIR /app
COPY ./build.js ./
COPY ./package*.json ./
RUN npm ci
COPY ./src/ ./src/
RUN npm run build

FROM node:18-alpine as runner

FROM gcr.io/distroless/nodejs18-debian12:nonroot AS runner
WORKDIR /app
ENV NODE_ENV=production

COPY --from=builder /app/dist/main.js ./dist
COPY ./package.json ./

RUN npm install

CMD ["node", "main.js"]
COPY --from=builder /app/dist/ ./dist/
COPY --from=deps /app/node_modules/ ./node_modules/
CMD ["dist/main.js"]

0 comments on commit 1bf7d6e

Please sign in to comment.