chore: make Docker image run without root user (#67)

This commit is contained in:
Elias Schneider
2024-11-21 18:44:43 +01:00
committed by GitHub
parent e784093342
commit 46eef1fcb7
4 changed files with 35 additions and 3 deletions

View File

@@ -21,7 +21,10 @@ RUN CGO_ENABLED=1 GOOS=linux go build -o /app/backend/pocket-id-backend .
# Stage 3: Production Image
FROM node:20-alpine
RUN apk add --no-cache caddy
# Delete default node user
RUN deluser --remove-home node
RUN apk add --no-cache caddy su-exec
COPY ./reverse-proxy /etc/caddy/
WORKDIR /app
@@ -41,5 +44,5 @@ RUN chmod +x ./scripts/*.sh
EXPOSE 80
ENV APP_ENV=production
# Use a shell form to run both the frontend and backend
CMD ["sh", "./scripts/docker-entrypoint.sh"]
ENTRYPOINT ["sh", "./scripts/docker/create-user.sh"]
CMD ["sh", "./scripts/docker/entrypoint.sh"]