From d581ed8ae3d263b0bbdd5d679513a23e2d464c3f Mon Sep 17 00:00:00 2001 From: Nikhil Badyal <59223300+nikhilbadyal@users.noreply.github.com> Date: Fri, 25 Aug 2023 19:04:43 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Added=20Dockerfile=20(#309)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-artifact.yml | 2 +- Dockerfile | 43 ++++++---------------------- Dockerfile-base | 36 +++++++++++++++++++++++ docker-compose.yml | 1 + 4 files changed, 47 insertions(+), 35 deletions(-) create mode 100644 Dockerfile-base diff --git a/.github/workflows/build-artifact.yml b/.github/workflows/build-artifact.yml index c677017..a0153e8 100644 --- a/.github/workflows/build-artifact.yml +++ b/.github/workflows/build-artifact.yml @@ -73,7 +73,7 @@ jobs: - name: Build Revanced APKs run: | - docker-compose up --build + docker-compose -f docker-compose-local.yml up --build - name: Upload Build APKS uses: actions/upload-artifact@main diff --git a/Dockerfile b/Dockerfile index fbc894d..5e29f06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,17 @@ -ARG PYTHON_VERSION=3.11-slim-bullseye - -FROM python:${PYTHON_VERSION} AS python - - -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 - -RUN apt-get -qq update && \ - apt-get -qq -y --no-install-recommends install gnupg software-properties-common locales curl tzdata && \ - 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 dist-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 -y autoremove && \ - rm -rf /var/lib/apt/lists/* zulu-repo_${ZULU_REPO_VER}_all.deb - -ENV JAVA_HOME=/usr/lib/jvm/zulu17-ca-amd64 +FROM nikhilbadyal/docker-py-revanced-base +# Copy and install Python dependencies COPY requirements.txt . -# Update PIP -RUN python -m pip install --upgrade pip -# Create Python Dependency and Sub-Dependency Wheels. -RUN pip install -r requirements.txt +RUN python -m pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt + +# Copy entrypoint script COPY ./entrypoint /entrypoint RUN sed -i 's/\r$//g' /entrypoint && chmod +x /entrypoint -# copy application code to WORKDIR + +# Copy application code COPY . ${APP_HOME} +# Set the default command to run the entrypoint script CMD ["bash","/entrypoint"] diff --git a/Dockerfile-base b/Dockerfile-base new file mode 100644 index 0000000..4e9431c --- /dev/null +++ b/Dockerfile-base @@ -0,0 +1,36 @@ +# Use a specific version of the base Python image +ARG PYTHON_VERSION=3.11-slim-bullseye + +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 && \ + 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 + +CMD ["bash"] diff --git a/docker-compose.yml b/docker-compose.yml index edbef92..46d7fa1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: revanced: image: nikhilbadyal/docker-py-revanced container_name: revanced-builder + platform: linux/amd64 env_file: - .env volumes: