Skip to content
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
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

# Build stage — installs all deps, generates prisma, builds shared + target
FROM node:${NODE_VERSION} AS build
ARG NPM_CACHE_KEY

Check warning on line 57 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build — bot

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NPM_CACHE_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 57 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build — backend

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NPM_CACHE_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 57 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build — frontend

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NPM_CACHE_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

RUN apk add --no-cache git build-base python3 python3-dev opus-dev && rm -rf /var/cache/apk/* && npm install -g npm@12.0.0 && npm cache clean --force

Expand Down Expand Up @@ -98,7 +98,7 @@

# Production deps — slim install (no dev deps)
FROM node:${NODE_VERSION} AS deps-production
ARG NPM_CACHE_KEY

Check warning on line 101 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build — bot

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NPM_CACHE_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 101 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build — backend

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "NPM_CACHE_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

# build-base + python3-dev + opus-dev: @discordjs/opus falls back to a source
# build whenever its musl prebuilt is missing for the current base image
Expand Down Expand Up @@ -141,11 +141,18 @@
COPY --from=build /app/packages/shared/src/generated ./packages/shared/dist/generated
COPY --from=build /app/packages/bot/dist ./packages/bot/dist
COPY --from=build /app/prisma ./prisma
# Bake the Prisma engines. `prisma`/`@prisma/engines` are devDeps, so the
# deps-production `npm ci --omit=dev` above ships node_modules WITHOUT the
# migrate schema-engine — `prisma migrate deploy` then tries to download it at
# boot (fails for uid 1001 on a root-owned dir; needs the CDN reachable). The
# build stage's full `npm ci` already has the engines, so copy them in: no
# runtime download, no boot-time Prisma-CDN dependency. (#1734)
COPY --from=build /app/node_modules/@prisma ./node_modules/@prisma

RUN mkdir -p downloads logs && \
addgroup -g 1001 -S nodejs && \
adduser -S bot -u 1001 -G nodejs && \
chown -R bot:nodejs /app/downloads /app/logs && \
chown -R bot:nodejs /app/downloads /app/logs /app/node_modules/@prisma && \
chmod -R 755 /app/downloads

USER bot
Expand Down
Loading