Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Commit 620072d

Browse files
committed
Allow nonroot to run app
1 parent 8fdf861 commit 620072d

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ FROM alpine:latest
2828
# Install ca-certificates for HTTPS (no sqlite library needed)
2929
RUN apk --no-cache add ca-certificates
3030

31-
WORKDIR /root/
31+
# Create a non-root user with UID 1000
32+
RUN adduser -D -u 1000 -g 1000 -s /bin/sh appuser
33+
34+
# Set working directory
35+
WORKDIR /app
3236

3337
# Copy the binary from builder stage
3438
COPY --from=builder /app/passkey-auth .
@@ -39,8 +43,11 @@ COPY --from=builder /app/web ./web/
3943
# Copy default config
4044
COPY --from=builder /app/config.yaml .
4145

42-
# Create directory for database
43-
RUN mkdir -p /data
46+
# Create directory for database and set ownership
47+
RUN mkdir -p /data && chown -R appuser:appuser /app /data
48+
49+
# Switch to non-root user
50+
USER appuser
4451

4552
# Expose port
4653
EXPOSE 8080

0 commit comments

Comments
 (0)