Peiyan commited on
Commit
7b72076
·
verified ·
1 Parent(s): 3c9ef9b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -7
Dockerfile CHANGED
@@ -15,7 +15,7 @@ WORKDIR /app/frontend
15
  RUN npm run build
16
 
17
  FROM python:3.10.13-slim-bullseye
18
- RUN apt-get update && apt-get install -y nginx \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
  RUN python3 -m pip install --upgrade pip \
@@ -24,11 +24,11 @@ RUN python3 -m pip install --upgrade pip \
24
  COPY ./backend ./backend
25
  RUN pip install -r ./backend/requirements.txt
26
 
27
- # Ensure necessary permissions
28
  RUN chmod -R 755 /var/log/nginx && \
29
  chmod -R 755 /var/lib/nginx && \
30
- chown -R www-data:www-data /var/log/nginx && \
31
- chown -R www-data:www-data /var/lib/nginx
32
 
33
  # Step #3: configure nginx and flask
34
  COPY --from=build-step /app/frontend/build /usr/share/nginx/html
@@ -36,10 +36,11 @@ COPY deployment/docker/nginx.conf /etc/nginx/sites-enabled/default
36
  COPY deployment/docker/serve.sh .
37
  RUN chmod a+x ./serve.sh
38
 
39
- # Set Nginx user
40
- USER www-data
41
-
42
  EXPOSE 80
43
 
 
 
 
44
  ENTRYPOINT ["/bin/bash"]
45
  CMD ["./serve.sh"]
 
15
  RUN npm run build
16
 
17
  FROM python:3.10.13-slim-bullseye
18
+ RUN apt-get update && apt-get install -y nginx \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
  RUN python3 -m pip install --upgrade pip \
 
24
  COPY ./backend ./backend
25
  RUN pip install -r ./backend/requirements.txt
26
 
27
+ # Ensure necessary permissions and create directories
28
  RUN chmod -R 755 /var/log/nginx && \
29
  chmod -R 755 /var/lib/nginx && \
30
+ mkdir -p /var/lib/nginx/body && \
31
+ chown -R root:root /var/log/nginx /var/lib/nginx /usr/share/nginx/html
32
 
33
  # Step #3: configure nginx and flask
34
  COPY --from=build-step /app/frontend/build /usr/share/nginx/html
 
36
  COPY deployment/docker/serve.sh .
37
  RUN chmod a+x ./serve.sh
38
 
39
+ # Expose port 80
 
 
40
  EXPOSE 80
41
 
42
+ # Run as root user
43
+ USER root
44
+
45
  ENTRYPOINT ["/bin/bash"]
46
  CMD ["./serve.sh"]