Spaces:
Running
Running
Commit
·
87d3d61
1
Parent(s):
343b64b
update
Browse files- Dockerfile +10 -6
- nginx.conf +3 -2
Dockerfile
CHANGED
|
@@ -19,15 +19,19 @@ RUN npm run build
|
|
| 19 |
# Stage 2: Serve the built app with a lightweight web server
|
| 20 |
FROM nginx:alpine
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Copy the built files from the previous stage
|
| 23 |
COPY --from=build /app/dist /usr/share/nginx/html
|
| 24 |
|
| 25 |
-
# Expose port 7860
|
| 26 |
-
EXPOSE 7860
|
| 27 |
-
|
| 28 |
# Replace the default nginx.conf with our configuration
|
| 29 |
-
RUN rm /etc/nginx/conf.d/default.conf
|
| 30 |
COPY nginx.conf /etc/nginx/conf.d
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
| 19 |
# Stage 2: Serve the built app with a lightweight web server
|
| 20 |
FROM nginx:alpine
|
| 21 |
|
| 22 |
+
# Set up a new user named "user" with user ID 1001
|
| 23 |
+
RUN adduser -D -u 1001 user
|
| 24 |
+
|
| 25 |
+
# Switch to the root user to perform privileged operations
|
| 26 |
+
USER root
|
| 27 |
+
|
| 28 |
+
# Remove the default Nginx configuration file
|
| 29 |
+
RUN rm /etc/nginx/conf.d/default.conf
|
| 30 |
+
|
| 31 |
# Copy the built files from the previous stage
|
| 32 |
COPY --from=build /app/dist /usr/share/nginx/html
|
| 33 |
|
|
|
|
|
|
|
|
|
|
| 34 |
# Replace the default nginx.conf with our configuration
|
|
|
|
| 35 |
COPY nginx.conf /etc/nginx/conf.d
|
| 36 |
|
| 37 |
+
# Change ownership of the
|
|
|
nginx.conf
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
server {
|
| 2 |
-
listen 7860;
|
|
|
|
| 3 |
|
| 4 |
-
server_name
|
| 5 |
|
| 6 |
location / {
|
| 7 |
root /usr/share/nginx/html;
|
|
|
|
| 1 |
server {
|
| 2 |
+
listen 7860 default_server;
|
| 3 |
+
listen [::]:7860 default_server;
|
| 4 |
|
| 5 |
+
server_name _;
|
| 6 |
|
| 7 |
location / {
|
| 8 |
root /usr/share/nginx/html;
|