Skip to content

Commit

Permalink
Merge pull request #47 from mischaikow/refine-script
Browse files Browse the repository at this point in the history
Refined Dockerfile
  • Loading branch information
mischaikow authored Nov 17, 2024
2 parents 94ec11b + ccd0951 commit 622ad9f
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,26 @@ ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable


FROM base AS prod
## Build stage
FROM base AS build

WORKDIR /app
COPY pnpm-lock.yaml package.json /app
RUN pnpm install --frozen-lockfile

COPY . /app
COPY ./src /app/src
RUN pnpm build


## Run stage
FROM base

RUN apk add dumb-init

WORKDIR /app
COPY --from=build --chown=node:node /app/dist /app/dist
COPY --from=build --chown=node:node /app/node_modules /app/node_modules
COPY --from=build --chown=node:node /app/package.json /app/package.json

COPY --from=prod /app/node_modules /app/node_modules
COPY --from=prod /app/dist /app/dist
COPY ./src /app/src

COPY --chown=node:node . .
EXPOSE 3000:3000
USER node
CMD ["dumb-init", "node", "dist/server.js"]
CMD ["dumb-init", "node", "dist/server.js"]

0 comments on commit 622ad9f

Please sign in to comment.