Skip to content

Commit

Permalink
build: use ubuntu user instead of root for container execution (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mogyuchi authored Feb 16, 2025
1 parent 045c04d commit 22aee99
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions migrate.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ RUN --mount=type=cache,id=pnpm-$BUILDPLATFORM,target=/.pnpm-store/ \
pnpm install --frozen-lockfile --offline --dev

FROM base AS runner
USER ubuntu
WORKDIR /app
COPY --link prisma/ prisma/
COPY --link --from=fetch-deps /pnpm/ /pnpm/
COPY --link --from=dev-deps /_/node_modules/ ./node_modules/
COPY --link .npmrc package.json ./
# HACK(?): ここではUIDを指定する必要があります。usernameにしているとビルドできません。
# `Error: buildx failed with: ERROR: failed to solve: invalid user index: -1`
COPY --chown=1000 --link prisma/ prisma/
COPY --chown=1000 --link --from=fetch-deps /pnpm/ /pnpm/
COPY --chown=1000 --link --from=dev-deps /_/node_modules/ ./node_modules/
COPY --chown=1000 --link .npmrc package.json ./
ENTRYPOINT [ "pnpm", "--shell-emulator" ]
CMD [ "db:deploy" ]

0 comments on commit 22aee99

Please sign in to comment.