-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (34 loc) · 928 Bytes
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
### BUILD UI ###
FROM node:lts-alpine AS UI_BUILD
WORKDIR /zatrol-ui
COPY zatrol-ui /zatrol-ui
RUN npm install
RUN npm run build
### BUILD BE ###
FROM python:3.9-slim-buster as BE_BUILD
WORKDIR /build
COPY setup.py ./setup.py
COPY zatrol ./zatrol
COPY requirements.txt ./requirements.txt
RUN pip install --upgrade pip setuptools wheel
RUN python ./setup.py bdist_wheel --dist-dir /dist
### RUN ###
FROM python:3.9-slim-buster
EXPOSE 8080
ENV DATABASE_URL=
ENV API_KEY=
ENV CHAMPS_INTERVAL_H=
ENV HISTORY_INTERVAL_H=
ENV RESOURCES=/resources
ENV UI_BUILD=/zatrol-ui/build
ENV SERVE_UI=1
WORKDIR /app
# copy build artifacts
COPY resources /resources
COPY --from=UI_BUILD /zatrol-ui/build /zatrol-ui/build
COPY --from=BE_BUILD /dist ./app_wheels
# install the app
RUN pip install --upgrade pip setuptools
RUN pip install ./app_wheels/*
# run the app
CMD uvicorn --factory "zatrol:create_app" --host 0.0.0.0 --port 8080