-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
51 lines (39 loc) · 1.06 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM python:3.7-slim AS base
LABEL maintainer="Micheal Waltz <[email protected]>"
#Application directory
WORKDIR /app
#Environment settings
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1
#Install runtime deps
RUN apt update && apt install --no-install-recommends -y \
mariadb-client-core-10.1
#Build image
FROM base AS build
#Install build deps
RUN apt update && apt install --no-install-recommends -y \
build-essential \
python-dev \
libffi-dev \
zlib1g-dev \
python3-pip \
python3-dev \
python3-setuptools
# Requirements have to be pulled and installed here, otherwise caching won't work
COPY ./requirements.txt /var/tmp/
RUN pip3 install --no-cache-dir -r /var/tmp/requirements.txt
#Run image
FROM base AS run
#Copy files from build image
COPY --from=build /usr/local/ /usr/local/
#Copy app
COPY . /app
#Run as non-root user
RUN chown -R daemon:daemon /app/
USER daemon
#Service ports
EXPOSE 5000
EXPOSE 5001
#Entrypoint for apps, has two apps: dashboard and hardware
ENTRYPOINT ["python"]
CMD ["portal.py"]