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

7 chore clean up dockerfile #8

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Changes from all commits
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
24 changes: 15 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
FROM node:20-bullseye-slim as base

RUN apt-get update && apt-get install -y make g++ python3
RUN ln -sf /usr/bin/python3 /usr/bin/python
FROM base as production_buildstage

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package.json package-lock.json ./

FROM base as production
COPY package*.json ./

USER node
RUN npm ci

COPY --chown=node:node . ./
RUN npm run build

EXPOSE 8080
FROM base as production

ENV NODE_ENV=production

USER node
WORKDIR /home/node/app

COPY package.json package-lock.json ./
RUN npm ci

COPY --from=production_buildstage /home/node/app/dist /home/node/app/dist

ENTRYPOINT ["npm", "run", "start:prod"]

FROM base as development
USER node

WORKDIR /home/node/app
Loading