Skip to content

Commit

Permalink
fix: clever installation of packages
Browse files Browse the repository at this point in the history
  • Loading branch information
jpantos committed Aug 9, 2024
1 parent 7f35e29 commit a36a2b2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,22 @@ RUN apt-get update
COPY --from=dev /app/dist/pantos-service-node_*.deb .

RUN ARCH=$(dpkg --print-architecture) && \
if [ -f ./*-signed.deb ]; then \
apt-get install -y --no-install-recommends ./*_${ARCH}-signed.deb ./*_all-signed.deb; \
else \
apt-get install -y --no-install-recommends ./*.deb; \
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 && \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ debian:
dpkg-buildpackage -uc -us -g
mkdir -p dist
ARCHITECTURE=$$(dpkg --print-architecture); \
mv ../$(debian_package) dist/panto-service-node_$(PANTOS_SERVICE_NODE_VERSION)_$${ARCHITECTURE}.deb
mv ../$(debian_package) dist/pantos-service-node_$(PANTOS_SERVICE_NODE_VERSION)_$${ARCHITECTURE}.deb

.PHONY: debian-all
debian-all: debian debian-full
Expand Down

0 comments on commit a36a2b2

Please sign in to comment.