-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
72 lines (56 loc) · 2.05 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
72
#syntax=docker/dockerfile:1.7.0-labs
# SPDX-License-Identifier: GPL-3.0-only
FROM python:3.12-bookworm AS dev
RUN apt-get update && \
apt-get install build-essential debhelper devscripts \
equivs dh-virtualenv python3-venv dh-sysuser dh-exec \
-y --no-install-recommends
ENV PATH="/root/miniconda3/bin:${PATH}"
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"; \
elif [ "$ARCH" = "aarch64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh"; \
else \
echo "Unsupported architecture: $ARCH"; \
exit 1; \
fi && \
wget "$MINICONDA_URL" -O miniconda.sh && \
mkdir /root/.conda && \
bash miniconda.sh -b && \
rm -f miniconda.sh
RUN python3 -m pip install poetry
WORKDIR /app
COPY . /app
RUN make debian-build-deps
RUN make debian debian-full wheel
FROM bitnami/minideb:bookworm AS prod
RUN apt-get update
# Do not copy the configurator package
COPY --from=dev /app/dist/pantos-service-node_*.deb .
RUN ARCH=$(dpkg --print-architecture) && \
PKGS=$(ls ./*-signed.deb 2>/dev/null || ls ./*.deb) && \
INSTALLED_COUNT=0 && \
for pkg in $PKGS; do \
if [ -f "$pkg" ]; then \
PKG_ARCH=$(dpkg-deb --field "$pkg" Architecture) && \
if [ "$PKG_ARCH" = "all" ] || [ "$PKG_ARCH" = "$ARCH" ]; then \
apt-get install -f -y --no-install-recommends "$pkg" && \
INSTALLED_COUNT=$((INSTALLED_COUNT + 1)); \
else \
echo "Skipping $pkg due to architecture mismatch"; \
fi; \
fi; \
done && \
if [ "$INSTALLED_COUNT" -eq 0 ]; then \
echo "Error: No packages were installed" >&2; \
exit 1; \
fi && \
rm -rf *.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
FROM prod AS servicenode
ENV APP_PORT=8080
ENTRYPOINT ["/usr/bin/pantos-service-node-server"]
FROM prod AS servicenode-celery-worker
ENTRYPOINT ["/usr/bin/pantos-service-node-celery"]