Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
use venv in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
steersbob committed Sep 15, 2023
1 parent c36d8c5 commit fd5afdf
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM python:3.11-bookworm as base

COPY ./dist /app/dist

ENV PIP_EXTRA_INDEX_URL=https://www.piwheels.org/simple
ENV PIP_FIND_LINKS=/wheeley
ENV VENV=/app/.venv
ENV PATH="$VENV/bin:$PATH"

COPY ./dist /app/dist

RUN <<EOF
set -ex

mkdir /wheeley
python3 -m venv $VENV
pip3 install --upgrade pip wheel setuptools
pip3 wheel --wheel-dir=/wheeley -r /app/dist/requirements.txt
pip3 wheel --wheel-dir=/wheeley /app/dist/*.tar.gz
Expand All @@ -18,14 +21,19 @@ FROM python:3.11-slim-bookworm
EXPOSE 5000
WORKDIR /app

ENV PIP_FIND_LINKS=/wheeley
ENV VENV=/app/.venv
ENV PATH="$VENV/bin:$PATH"

COPY --from=base /wheeley /wheeley

RUN <<EOF
set -ex

pip3 install --no-index --find-links=/wheeley brewblox-plaato
rm -rf /wheeley
python3 -m venv $VENV
pip3 install --no-index brewblox_plaato
pip3 freeze
rm -rf /wheeley
EOF

ENTRYPOINT ["python3", "-m", "brewblox_plaato"]

0 comments on commit fd5afdf

Please sign in to comment.