Peiyan commited on
Commit
78e8583
·
verified ·
1 Parent(s): f832d5b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -16
Dockerfile CHANGED
@@ -6,6 +6,8 @@ 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
  RUN npm install
10
 
11
  WORKDIR /app
@@ -14,32 +16,29 @@ COPY ./frontend ./frontend
14
  WORKDIR /app/frontend
15
  RUN npm run build
16
 
17
- # Step #2: Set up Python environment and install dependencies
18
- FROM python:3.10.13-slim-bullseye
19
- RUN apt-get update && apt-get install -y nginx \
20
  && rm -rf /var/lib/apt/lists/*
21
 
 
22
  RUN python3 -m pip install --upgrade pip \
23
  && pip install gunicorn==20.1.0
24
 
 
 
25
  COPY ./backend ./backend
26
  RUN pip install -r ./backend/requirements.txt
27
 
28
- # Step #3: Configure nginx and flask
29
- COPY --from=build-step /app/frontend/build /var/www/html
30
  COPY deployment/docker/nginx.conf /etc/nginx/sites-enabled/default
31
  COPY deployment/docker/serve.sh .
32
- RUN chmod +x ./serve.sh
33
-
34
- # Ensure nginx can write to necessary directories
35
- RUN mkdir -p /var/lib/nginx/body /var/lib/nginx/proxy /var/lib/nginx/fastcgi /var/lib/nginx/uwsgi /var/lib/nginx/scgi /var/log/nginx /var/www/html \
36
- && touch /var/log/nginx/error.log /var/log/nginx/access.log \
37
- && chown -R www-data:www-data /var/lib/nginx /var/log/nginx /var/www/html \
38
- && chmod -R 755 /var/lib/nginx /var/log/nginx /var/www/html
39
-
40
- # Remove the user directive if present
41
- RUN sed -i '/^user /d' /etc/nginx/nginx.conf
42
 
 
43
  EXPOSE 80
44
  ENTRYPOINT ["/bin/bash"]
45
- 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
+ # It's OK to have multiple consecutive `RUN` instructions.
10
+ # hadolint ignore=DL3059
11
  RUN npm install
12
 
13
  WORKDIR /app
 
16
  WORKDIR /app/frontend
17
  RUN npm run build
18
 
19
+ 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"]