-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
72 lines (60 loc) · 2.1 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM debian:bookworm AS build
ENV PYTHONDONTWRITEBYTECODE=1
# install build dependencies
RUN set -eux; \
apt update; \
apt install -y --no-install-recommends \
g++ \
gcc \
python3-dev \
python3-pip \
python3-venv \
# include pyqt deps so pip does not install them later
python3-pyqt5 \
python3-pyqt5.qsci \
python3-pyqt5.qtsvg \
; \
apt list --installed $(apt-mark showmanual) > /.apt-deps-build
COPY pyproject.toml /src/pyproject.toml
# We need to copy the README too because it's used in pyproject.toml when
# building the package.
COPY README.md /src/README.md
# set up venv and python dependencies
RUN set -eux; \
mkdir -p /src/damnit; \
# install dependencies w/o installing package itself
# https://github.com/pypa/pip/issues/11440
echo '"""Hello"""' > /src/damnit/__init__.py; \
echo '__version__="0.0.0"' >> /src/damnit/__init__.py; \
python3 -m venv --system-site-packages /app; \
/app/bin/python3 -m pip install "/src[gui,backend]"; \
/app/bin/python3 -m pip uninstall -y damnit; \
/app/bin/python3 -m pip freeze > /.python-deps-build
FROM debian:bookworm-slim
COPY --from=build /app /app
COPY --from=build /.apt-deps-build /.apt-deps-build
COPY --from=build /.python-deps-build /.python-deps-build
ENV PATH="/app/bin:${PATH}"
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
# install runtime dependencies
RUN set -eux; \
apt update; \
apt install -y --no-install-recommends \
ca-certificates \
python3-pyqt5 \
python3-pyqt5.qsci \
python3-pyqt5.qtsvg \
; \
apt clean; \
rm -rf /var/lib/apt/lists/*; \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
apt list --installed $(apt-mark showmanual) > /.apt-deps-runtime
# install DAMNIT
COPY . /src
RUN set -eux; \
/app/bin/python3 -m pip install -vv --no-cache-dir "/src[gui,backend]"; \
/app/bin/python3 -m pip freeze > /.python-deps-runtime; \
python3 -m pip check; \
python3 -c "import damnit; print(damnit.__version__)"
CMD ["/app/bin/amore-proto", "gui"]