Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +6 -4
Dockerfile
CHANGED
|
@@ -5,7 +5,7 @@ FROM node:16 as builder
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy package.json and install dependencies
|
| 8 |
-
COPY package*.json ./
|
| 9 |
RUN npm install
|
| 10 |
|
| 11 |
# Copy the rest of the application code
|
|
@@ -19,15 +19,17 @@ FROM nginx:alpine
|
|
| 19 |
|
| 20 |
# Set user to root temporarily to fix permissions
|
| 21 |
USER root
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# Copy built React files
|
| 25 |
COPY --from=builder /app/build /usr/share/nginx/html
|
| 26 |
|
| 27 |
-
#
|
| 28 |
RUN sed -i 's/listen\s\+80;/listen 8080;/' /etc/nginx/conf.d/default.conf
|
| 29 |
|
| 30 |
-
# Expose
|
| 31 |
EXPOSE 8080
|
| 32 |
|
| 33 |
# Start Nginx
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy package.json and install dependencies
|
| 8 |
+
COPY package*.json ./
|
| 9 |
RUN npm install
|
| 10 |
|
| 11 |
# Copy the rest of the application code
|
|
|
|
| 19 |
|
| 20 |
# Set user to root temporarily to fix permissions
|
| 21 |
USER root
|
| 22 |
+
|
| 23 |
+
# Fix permissions for nginx cache and /run directory
|
| 24 |
+
RUN mkdir -p /var/cache/nginx /run && chmod -R 777 /var/cache/nginx /run
|
| 25 |
|
| 26 |
# Copy built React files
|
| 27 |
COPY --from=builder /app/build /usr/share/nginx/html
|
| 28 |
|
| 29 |
+
# (Optional) Fix Nginx listen port if needed
|
| 30 |
RUN sed -i 's/listen\s\+80;/listen 8080;/' /etc/nginx/conf.d/default.conf
|
| 31 |
|
| 32 |
+
# Expose correct port
|
| 33 |
EXPOSE 8080
|
| 34 |
|
| 35 |
# Start Nginx
|