# Use a specific version of the base Python image ARG PYTHON_VERSION=3.13.1-slim-bookworm FROM python:${PYTHON_VERSION} AS python # Set ARGs and ENVs ARG APP_HOME=/app ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 WORKDIR ${APP_HOME} ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' ARG ZULU_REPO_VER=1.0.0-3 # Update package lists and install required packages RUN apt-get -qq update && \ apt-get -qq -y --no-install-recommends install gnupg software-properties-common locales curl tzdata git && \ echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \ locale-gen en_US.UTF-8 && \ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xB1998361219BD9C9 && \ curl -sLO https://cdn.azul.com/zulu/bin/zulu-repo_${ZULU_REPO_VER}_all.deb && dpkg -i zulu-repo_${ZULU_REPO_VER}_all.deb && \ apt-get -qq update && \ apt-get -qq -y upgrade && \ mkdir -p /usr/share/man/man1 && \ echo "Package: zulu17-*\nPin: version 17.0.4-*\nPin-Priority: 1001" > /etc/apt/preferences && \ apt-get -qq -y --no-install-recommends install zulu17-jdk=17.0.4-* && \ apt-get -qq -y purge gnupg software-properties-common curl && \ apt-get -y autoremove && \ rm -rf /var/lib/apt/lists/* zulu-repo_${ZULU_REPO_VER}_all.deb # Set Java home environment variable ENV JAVA_HOME=/usr/lib/jvm/zulu17-ca-amd64 # Ensure curl and jq are available for the next step RUN apt-get update && \ apt-get install -y curl jq libssl3 && \ rm -rf /var/lib/apt/lists/* ENV PATH="/usr/local/bin:${PATH}" # Now use them safely RUN set -eux; \ ARCH="$(uname -m)"; \ case "$ARCH" in \ x86_64) ARCH_NAME="x86_64-unknown-linux-gnu" ;; \ aarch64) ARCH_NAME="aarch64-unknown-linux-gnu" ;; \ *) echo "Unsupported arch: $ARCH" && exit 1 ;; \ esac; \ URL=$(curl -s https://api.github.com/repos/EFForg/apkeep/releases/latest \ | jq -r ".assets[] | select(.name == \"apkeep-${ARCH_NAME}\") | .browser_download_url"); \ curl -L "$URL" -o /usr/local/bin/apkeep; \ chmod +x /usr/local/bin/apkeep; \ echo "Installed apkeep from $URL"; \ /usr/local/bin/apkeep --version CMD ["bash"]