Spaces:
Runtime error
Runtime error
Add files via upload
Browse files- Dockerfile +44 -0
Dockerfile
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Step #1: build the React front end
|
2 |
+
FROM node:14-bullseye-slim as build-step
|
3 |
+
WORKDIR /app
|
4 |
+
ENV PATH /app/node_modules/.bin:$PATH
|
5 |
+
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
|
14 |
+
COPY ./frontend ./frontend
|
15 |
+
|
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"]
|