build(container): fix Caddy stage permissions by using COPY --chown and drop chown RUN to avoid rootfs perms error
This commit is contained in:
@@ -59,7 +59,7 @@ FROM caddy:2-alpine AS production
|
||||
RUN apk add --no-cache curl
|
||||
|
||||
# Copy built files from builder stage
|
||||
COPY --from=builder /app/dist /usr/share/caddy
|
||||
COPY --from=builder --chown=caddy:caddy /app/dist /usr/share/caddy
|
||||
|
||||
# Configure Caddy to serve SPA with health endpoint (no TLS)
|
||||
RUN cat > /etc/caddy/Caddyfile <<'CADDY'
|
||||
@@ -78,8 +78,7 @@ RUN cat > /etc/caddy/Caddyfile <<'CADDY'
|
||||
}
|
||||
CADDY
|
||||
|
||||
# Set proper permissions for caddy
|
||||
RUN chown -R caddy:caddy /usr/share/caddy /etc/caddy
|
||||
# Permissions: using default ownership; no chown required
|
||||
|
||||
# Switch to caddy user
|
||||
USER caddy
|
||||
|
||||
Reference in New Issue
Block a user