1 Commits
Author SHA1 Message Date
maro 82a89cd3d9 Fix media permissions inside app container
Release / promote-and-deploy (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / build-image (push) Canceled after 0s
2026-09-18 02:22:15 +02:00
2 changed files with 18 additions and 2 deletions
+6 -2
View File
@@ -5,10 +5,10 @@
# .env.example) - this image builds without a database connection. # .env.example) - this image builds without a database connection.
FROM node:22-alpine AS base FROM node:22-alpine AS base
RUN apk add --no-cache libc6-compat su-exec
# ---- deps: install once, cached as its own layer ------------------------- # ---- deps: install once, cached as its own layer -------------------------
FROM base AS deps FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm ci RUN npm ci
@@ -41,7 +41,11 @@ COPY --from=builder --chown=nextjs:nodejs /app /app
# Docker volumes mounted over these paths (see docker-compose.yml). # Docker volumes mounted over these paths (see docker-compose.yml).
RUN mkdir -p media backups && chown -R nextjs:nodejs media backups RUN mkdir -p media backups && chown -R nextjs:nodejs media backups
USER nextjs COPY --from=builder --chown=root:root /app/docker/anouma-entrypoint.sh /usr/local/bin/anouma-entrypoint.sh
RUN chmod 755 /usr/local/bin/anouma-entrypoint.sh
USER root
ENTRYPOINT ["/usr/local/bin/anouma-entrypoint.sh"]
EXPOSE 3000 EXPOSE 3000
ENV PORT=3000 ENV PORT=3000
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -eu
# /app/media is a persistent host bind mount in production. Its host owner
# can differ from the unprivileged application user inside the image, so fix
# the mount ownership before dropping privileges for the actual app process.
if [ -d /app/media ]; then
chown -R nextjs:nodejs /app/media
chmod 775 /app/media
fi
exec su-exec nextjs "$@"