-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (30 loc) · 1.36 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
ARG gunicorn_version=20.0
FROM node:hydrogen-buster-slim AS frontend
WORKDIR /build
COPY ./frontend/package*.json ./
RUN npm ci
COPY ./frontend .
RUN npm run build
FROM python:3-slim-buster
WORKDIR /app
COPY ./backend/requirements.txt .
ARG gunicorn_version
RUN pip install \
--disable-pip-version-check \
--no-cache-dir \
--root-user-action=ignore \
-r requirements.txt \
gunicorn~=${gunicorn_version}
COPY ./backend/*.py ./
COPY --from=frontend /build/build ./frontend
ENV FLASK_FRONTEND_PATH='./frontend'
# Bind on 0.0.0.0 to expose server to the container's host.
# Add `--access-logfile=-` to log access to stdout (https://docs.gunicorn.org/en/latest/settings.html#logging).
# This can be done in the run command using `--env=GUNICORN_CMD_ARGS=--access-logfile=-`.
# If a reverse proxy sitting in front of the container, then the logged IP will be that of the host, i.e. 172.17.0.1,
# not that of the actual client. The reverse proxy will be able to log access more accurately.
# (I vaguely recall that the proxy can be set up to expose the real IP to the downstream service in a header.)
#ENTRYPOINT ["gunicorn", "--bind=0.0.0.0:8080", "app:app"]
# To run without WSGI server, do `ENTRYPOINT ["flask", "--app=./app.py", "run", "--host=0.0.0.0", "--port=8080"]` instead.
ENTRYPOINT ["flask", "--app=./app.py", "run", "--host=0.0.0.0", "--port=8080"]
EXPOSE 8080