Skip to content

Commit

Permalink
fix: update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Nov 27, 2023
1 parent 0f07022 commit d06ebf5
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,29 @@ RUN apk add --no-cache dumb-init

COPY --chown=node:node package.json .
COPY --chown=node:node yarn.lock .
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node .yarn/ .yarn/
COPY --chown=node:node graphql/ graphql/

RUN yarn install --immutable

ENTRYPOINT ["dumb-init", "--"]

# ================ #
# Builder Stage #
# ================ #

FROM base as builder

COPY --from=base --chown=node:node /usr/src/app/node_modules/ /usr/src/app/node_modules/

COPY --chown=node:node tsconfig.base.json tsconfig.base.json
COPY --chown=node:node tsup.config.ts tsup.config.ts
COPY --chown=node:node src/ src/
COPY --chown=node:node graphql/ graphql/
COPY --chown=node:node scripts/on-build-success.ts scripts/on-build-success.ts
COPY --chown=node:node .yarnrc.yml .
COPY --chown=node:node .yarn/ .yarn/
COPY --chown=node:node scripts/data-gen-scripts/tsconfig.json scripts/data-gen-scripts/tsconfig.json

ENTRYPOINT ["dumb-init", "--"]
RUN yarn build

# ================ #
# Runner Stage #
Expand All @@ -32,9 +46,8 @@ FROM base as runner
ENV NODE_ENV="production"
ENV NODE_OPTIONS="--enable-source-maps"

RUN yarn install --immutable

RUN yarn build
COPY --from=base --chown=node:node /usr/src/app/node_modules/ /usr/src/app/node_modules/
COPY --from=builder --chown=node:node /usr/src/app/api/ /usr/src/app/api/

USER node

Expand Down

0 comments on commit d06ebf5

Please sign in to comment.