Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Dockerfile #1

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
FROM node:18 as builder
# syntax=docker/dockerfile:1

FROM node:18 AS deps
ARG NODE_ENV=production
WORKDIR /app

COPY ./* ./

COPY ./package*.json .
RUN npm install
cm-ayf marked this conversation as resolved.
Show resolved Hide resolved
RUN npm run build

FROM node:18-alpine as runner
FROM deps AS builder
ARG NODE_ENV=development
WORKDIR /app
COPY ./src/ ./src/
RUN npm install
cm-ayf marked this conversation as resolved.
Show resolved Hide resolved
RUN --mount=type=bind,source=build.js,target=build.js \
npm run build

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

COPY --from=builder /app/dist/main.js ./dist
COPY --from=builder /app/dist/ ./dist/
COPY ./package.json ./
COPY --from=deps /app/node_modules/ ./node_modules/
cm-ayf marked this conversation as resolved.
Show resolved Hide resolved

RUN npm install

CMD ["node", "main.js"]
CMD ["dist/main.js"]