Spaces:
Running
Running
Fix Dockerfile
Browse files- Dockerfile +9 -3
Dockerfile
CHANGED
@@ -1,14 +1,20 @@
|
|
1 |
FROM nginx:alpine
|
2 |
|
|
|
|
|
|
|
|
|
3 |
RUN useradd -m -u 1000 user
|
4 |
-
USER user
|
5 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
7 |
WORKDIR /app
|
8 |
|
|
|
9 |
COPY index.html /usr/share/nginx/html
|
10 |
COPY nginx.conf /etc/nginx/nginx.conf
|
11 |
|
|
|
12 |
EXPOSE 7860
|
13 |
|
14 |
-
|
|
|
|
1 |
FROM nginx:alpine
|
2 |
|
3 |
+
# Install shadow package to get useradd command
|
4 |
+
RUN apk add --no-cache shadow
|
5 |
+
|
6 |
+
# Add a new user
|
7 |
RUN useradd -m -u 1000 user
|
|
|
|
|
8 |
|
9 |
+
# Set the working directory
|
10 |
WORKDIR /app
|
11 |
|
12 |
+
# Copy the HTML and nginx configuration files
|
13 |
COPY index.html /usr/share/nginx/html
|
14 |
COPY nginx.conf /etc/nginx/nginx.conf
|
15 |
|
16 |
+
# Expose port 7860
|
17 |
EXPOSE 7860
|
18 |
|
19 |
+
# Start nginx as root but serve files as non-root user
|
20 |
+
CMD ["sh", "-c", "nginx -g 'daemon off;'"]
|