Skip to content

Commit 89d9795

Browse files
committed
Run nginx from non-root user
1 parent e9a92db commit 89d9795

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
FROM openresty/openresty:1.21.4.2-alpine
2-
2+
# Create a non-root user
3+
RUN addgroup -g 1001 appgroup && \
4+
adduser -D -u 1000 -G appgroup -s /bin/sh app
5+
# Set correct permissions
36
COPY ./dist/ /app/
7+
RUN chown -R app:appgroup /app
8+
# Switch to non-root user
9+
USER 1000:1001
10+
# Optional: set workdir
11+
WORKDIR /app

0 commit comments

Comments
 (0)