-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
55 lines (41 loc) · 1.52 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
52
53
54
55
## Stage 1: Build image
FROM python:3.8 AS build-image
# Install S2i
RUN wget -c https://github.com/openshift/source-to-image/releases/download/v1.3.0/source-to-image-v1.3.0-eed2850f-linux-amd64.tar.gz \
&& tar -zxvf source-to-image-v1.3.0-eed2850f-linux-amd64.tar.gz \
&& cp s2i /usr/local/bin
# Install Traefik
RUN wget -c https://github.com/traefik/traefik/releases/download/v2.3.1/traefik_v2.3.1_linux_amd64.tar.gz \
&& tar -zxvf traefik_v2.3.1_linux_amd64.tar.gz \
&& cp traefik /usr/local/bin
# Setup virtualenv
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install python requirements
COPY ./requirements_manager.txt .
RUN pip install -r requirements_manager.txt
## Stage 2: Production image
FROM python:3.8-slim AS production-image
# Install Git
RUN apt-get update && apt-get install -y git
# Grab s2i and traefik
COPY --from=build-image /usr/local/bin /usr/local/bin
# Grab the virtualenv
COPY --from=build-image /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Add manager source code
COPY manager/ manager/
# Setting up manager instance with environment variables
ENV DAEPLOY_PROXY_HTTP_PORT=80
ENV DAEPLOY_PROXY_HTTPS_PORT=443
ENV DAEPLOY_MANAGER_IN_CONTAINER=True
# Handling version numbering
ARG version="latest"
ENV DAEPLOY_MANAGER_VERSION=${version}
# Expose ports that Traefik listens on (still need to be mapped when starting the container!)
EXPOSE 80
EXPOSE 443
# Set some labels
LABEL daeploy.type="manager"
LABEL maintainer="Viking Analytics AB"
ENTRYPOINT ["uvicorn", "manager.app:app"]