Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
CHANGED
@@ -14,3 +14,30 @@ COPY ./frontend ./frontend
|
|
14 |
WORKDIR /app/frontend
|
15 |
RUN npm run build
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 /var/lib/nginx/proxy /var/lib/nginx/fastcgi \
|
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"]
|