File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -9,8 +9,16 @@ python3 -m blueprint
99
1010### Using Docker
1111
12+ Development image:
1213``` shell
13- ...
14+ docker build -t blueprint -f dev.Dockerfile -t blueprint:dev .
15+ docker run blueprint:dev
16+ ```
17+
18+ Production (Distroless) image:
19+ ``` shell
20+ docker build -t blueprint -f prod.Dockerfile -t blueprint:prod .
21+ docker run blueprint:prod
1422```
1523
1624### Resources
Original file line number Diff line number Diff line change 11FROM python:3.8-slim AS builder
2- RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc
2+ RUN apt-get update && apt-get install -y --no-install-recommends --yes python3-venv gcc libpython3-dev && \
3+ python3 -m venv /venv && \
4+ /venv/bin/pip install --upgrade pip
5+
6+ FROM builder AS builder-venv
37
48COPY requirements.txt .
5- RUN pip install -r requirements.txt
9+ RUN /venv/bin/ pip install -r / requirements.txt
610
7- COPY . .
8- RUN python setup.py install
11+ FROM builder-venv AS tester
912
10- FROM python:3.8.1-alpine3.11 AS runner
11- COPY --from=builder /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
13+ COPY . /app
14+ WORKDIR /app
15+ RUN /venv/bin/pytest
1216
13- CMD ["python" , "-m" , "blueprint" ]
17+ FROM python:3.8.1-alpine3.11 AS runner
18+ COPY --from=tester /venv /venv
19+ COPY --from=tester /app /app
1420
21+ WORKDIR /app
1522
16- # TODO add test run to this image build
23+ ENTRYPOINT ["/venv/bin/python3" , "-m" , "blueprint" ]
24+ USER 1001
Original file line number Diff line number Diff line change 11FROM python:3.5-slim AS builder
2- RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc
2+ RUN apt-get update && apt-get install -y --no-install-recommends --yes python3-venv gcc libpython3-dev && \
3+ python3 -m venv /venv && \
4+ /venv/bin/pip install --upgrade pip
5+
6+ FROM builder AS builder-venv
37
48COPY requirements.txt .
5- RUN pip install -r requirements.txt
9+ RUN /venv/bin/pip install -r /requirements.txt
10+
11+ FROM builder-venv AS tester
612
7- COPY . .
8- RUN python setup.py install
13+ COPY . /app
14+ WORKDIR /app
15+ RUN /venv/bin/pytest
916
10- FROM gcr.io/distroless/python3 as runner
11- COPY --from=builder /usr/local/lib/python3.5/site-packages/ /usr/local/lib/python3.5/site-packages/
17+ FROM gcr.io/distroless/python3-debian10 AS runner
18+ COPY --from=tester /venv /venv
19+ COPY --from=tester /app /app
1220
13- ENV PYTHONPATH=/usr/local/lib/python3.5/site-packages/blueprint-0.0.1-py3.5.egg
14- ENTRYPOINT ["python" , "-m" , "blueprint" ]
21+ WORKDIR /app
1522
16- # TODO parametrize the version (Python and package version)
17- # TODO add test run to this image build
23+ ENTRYPOINT [ "/venv/bin/python3" , "-m" , "blueprint" ]
24+ USER 1001
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments