generated from BrewBlox/brewblox-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
42 lines (31 loc) · 851 Bytes
/
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
FROM python:3.11-bookworm as base
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
EOF
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
COPY ./parse_appenv.py ./parse_appenv.py
COPY ./entrypoint.sh ./entrypoint.sh
RUN <<EOF
set -ex
python3 -m venv $VENV
pip3 install --no-index brewblox_hass
pip3 freeze
rm -rf /wheeley
EOF
ENTRYPOINT ["bash", "./entrypoint.sh"]