Fix media directory permissions during deploy

This commit is contained in:
2026-09-18 02:09:16 +02:00
parent 661b12bb7b
commit e32dddd2cb
+8
View File
@@ -129,6 +129,14 @@ deploy_version() {
registry_login
log_info "Pulling ${ANOUMA_IMAGE} …"
$COMPOSE pull app || return 1
# The media directory is a bind mount. Its host ownership can differ from
# the unprivileged `nextjs` user inside the image, which otherwise turns a
# valid image upload into Payload's generic FileUploadError. The deploy user
# already controls Docker, so use the image's root user only for this narrow
# ownership repair before starting the app.
log_info "Preparing media storage permissions …"
$COMPOSE run --rm --user root --entrypoint /bin/sh app -c \
'mkdir -p /app/media && chown -R 1001:1001 /app/media && chmod 775 /app/media' || return 1
log_info "Running database migrations …"
$COMPOSE run --rm app npm run migrate || return 1
log_info "Starting containers …"