Peiyan commited on
Commit
3c9ef9b
·
verified ·
1 Parent(s): 009e100

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -10
Dockerfile CHANGED
@@ -6,8 +6,6 @@ RUN mkdir ./frontend
6
  COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
7
  WORKDIR /app/frontend
8
  RUN npm install -g [email protected]
9
- # It's OK to have multiple consecutive `RUN` instructions.
10
- # hadolint ignore=DL3059
11
  RUN npm install
12
 
13
  WORKDIR /app
@@ -20,25 +18,28 @@ FROM python:3.10.13-slim-bullseye
20
  RUN apt-get update && apt-get install -y nginx \
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
- # hadolint ignore=DL3013
24
  RUN python3 -m pip install --upgrade pip \
25
  && pip install gunicorn==20.1.0
26
 
27
-
28
-
29
  COPY ./backend ./backend
30
  RUN pip install -r ./backend/requirements.txt
31
 
 
 
 
 
 
 
32
  # Step #3: configure nginx and flask
33
  COPY --from=build-step /app/frontend/build /usr/share/nginx/html
34
  COPY deployment/docker/nginx.conf /etc/nginx/sites-enabled/default
35
  COPY deployment/docker/serve.sh .
36
  RUN chmod a+x ./serve.sh
37
 
38
- # run server
 
 
39
  EXPOSE 80
 
40
  ENTRYPOINT ["/bin/bash"]
41
- # Run with single core by default. Override this to run with more
42
- # workers. It is also possible to pass it any number of gunicorn
43
- # arguments.
44
- CMD ["./serve.sh"]
 
6
  COPY ./frontend/package.json ./frontend/package-lock.json ./frontend/
7
  WORKDIR /app/frontend
8
  RUN npm install -g [email protected]
 
 
9
  RUN npm install
10
 
11
  WORKDIR /app
 
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 \
22
  && pip install gunicorn==20.1.0
23
 
 
 
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
35
  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"]