Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +12 -13
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
|
@@ -16,29 +14,30 @@ COPY ./frontend ./frontend
|
|
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:
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
# run server
|
39 |
EXPOSE 80
|
40 |
ENTRYPOINT ["/bin/bash"]
|
41 |
-
|
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
|
|
|
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 /usr/share/nginx/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 \
|
36 |
+
&& chown -R www-data:www-data /var/lib/nginx \
|
37 |
+
&& chown -R www-data:www-data /var/log/nginx \
|
38 |
+
&& chmod -R 755 /var/lib/nginx \
|
39 |
+
&& chmod -R 755 /var/log/nginx
|
40 |
|
|
|
41 |
EXPOSE 80
|
42 |
ENTRYPOINT ["/bin/bash"]
|
43 |
+
CMD ["./serve.sh"]
|
|
|
|
|
|