Skip to content

Commit

Permalink
Dockerfileのコマンドの順番をキャッシュが効くように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
kabo2468 committed Jan 28, 2025
1 parent 13e2806 commit b1e7b09
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
&& pnpm run build

FROM base
ENV NODE_ENV=production
WORKDIR /app

COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/built /app/built
COPY config.json5 ngwords.txt package.json /app/

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008
RUN apt-get update \
Expand All @@ -48,6 +41,13 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV NODE_ENV=production
WORKDIR /app

COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/built /app/built
COPY config.json5 ngwords.txt package.json /app/

RUN chown -R node:node /app
USER node
CMD ["pnpm", "migrateandstart"]

0 comments on commit b1e7b09

Please sign in to comment.