AntDX316
commited on
Commit
·
480ee70
1
Parent(s):
3ecdadc
updated
Browse files- Dockerfile +6 -12
Dockerfile
CHANGED
@@ -1,33 +1,27 @@
|
|
1 |
FROM nginx:alpine
|
2 |
|
3 |
-
# Create a directory for the app
|
4 |
WORKDIR /app
|
5 |
|
6 |
-
# Copy the application files to the nginx html directory
|
7 |
COPY index.html /usr/share/nginx/html/
|
8 |
COPY styles.css /usr/share/nginx/html/
|
9 |
COPY script.js /usr/share/nginx/html/
|
10 |
|
11 |
-
#
|
12 |
-
RUN mkdir -p /
|
13 |
-
chown -R nginx:nginx /
|
14 |
-
chmod -R 755 /var/cache/nginx /var/run /var/log/nginx /usr/share/nginx/html
|
15 |
|
16 |
-
#
|
17 |
RUN echo $'server {\n\
|
18 |
listen 8080;\n\
|
19 |
server_name localhost;\n\
|
|
|
20 |
location / {\n\
|
21 |
root /usr/share/nginx/html;\n\
|
22 |
index index.html;\n\
|
23 |
}\n\
|
24 |
}' > /etc/nginx/conf.d/default.conf
|
25 |
|
26 |
-
# Use non-root user
|
27 |
USER nginx
|
28 |
-
|
29 |
-
# Change the port to 8080 since non-root can't bind to 80
|
30 |
EXPOSE 8080
|
31 |
|
32 |
-
|
33 |
-
CMD ["nginx", "-g", "daemon off;"]
|
|
|
1 |
FROM nginx:alpine
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
|
|
5 |
COPY index.html /usr/share/nginx/html/
|
6 |
COPY styles.css /usr/share/nginx/html/
|
7 |
COPY script.js /usr/share/nginx/html/
|
8 |
|
9 |
+
# Create necessary writable temp directories in /tmp
|
10 |
+
RUN mkdir -p /tmp/nginx/client_temp && \
|
11 |
+
chown -R nginx:nginx /tmp/nginx
|
|
|
12 |
|
13 |
+
# Custom Nginx config using /tmp for temp files
|
14 |
RUN echo $'server {\n\
|
15 |
listen 8080;\n\
|
16 |
server_name localhost;\n\
|
17 |
+
client_body_temp_path /tmp/nginx/client_temp;\n\
|
18 |
location / {\n\
|
19 |
root /usr/share/nginx/html;\n\
|
20 |
index index.html;\n\
|
21 |
}\n\
|
22 |
}' > /etc/nginx/conf.d/default.conf
|
23 |
|
|
|
24 |
USER nginx
|
|
|
|
|
25 |
EXPOSE 8080
|
26 |
|
27 |
+
CMD ["nginx", "-g", "daemon off;"]
|
|