-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (31 loc) · 1.13 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
ARG PLATFORM=linux/amd64
ARG VIRTUAL_ENV=/opt/venv
# ---FILE_LINTERS stage---
FROM --platform=$PLATFORM python:3.10.4-slim as file_linters
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN pip install --upgrade --progress-bar=off pip wheel \
&& pip install setuptools \
&& pip install poetry \
&& poetry export --without-hashes --only=file_linters --format=requirements.txt > requirements.txt \
&& pip install -r requirements.txt \
&& rm -rf /root/.cache/pip
COPY . /app
# ---BUILD stage---
FROM --platform=$PLATFORM python:3.10.4-slim as main_build_service
ARG VIRTUAL_ENV
ENV PYTHONPATH=$PYTHONPATH
ENV VIRTUAL_ENV=$VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV GOOGLE_CLOUD_PROJECT=weather-streamer
RUN python3 -m venv $VIRTUAL_ENV
WORKDIR /app
# Install python libaries based on poetry file
COPY poetry.lock pyproject.toml ./
RUN pip install --upgrade --progress-bar=off pip wheel \
&& pip install setuptools \
&& pip install poetry \
&& poetry export --without-hashes --format=requirements.txt > requirements.txt \
&& pip install -r requirements.txt # \
# && rm -rf /root/.cache/pip
COPY . /app