diff --git a/.github/workflows/build_docker_images.yml b/.github/workflows/build_docker_images.yml index 77e1368..ba8d1fc 100644 --- a/.github/workflows/build_docker_images.yml +++ b/.github/workflows/build_docker_images.yml @@ -67,7 +67,7 @@ jobs: uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64, linux/arm64 + platforms: linux/amd64, linux/arm64, linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index e9672d0..5947838 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ # syntax=docker/dockerfile:1 -FROM python:3.11-alpine3.19 as compiler +FROM python:3.11-alpine3.19 as BASE + +FROM base as compiler WORKDIR /app @@ -8,18 +10,26 @@ COPY src . RUN python3 -m compileall -b -f . && \ find . -name "*.py" -type f -delete -FROM python:3.11-alpine3.19 +FROM base as DEP_INSTALLER + +COPY requirements.txt . + +RUN apk add --no-cache gcc musl-dev && \ + pip install --upgrade pip wheel && \ + pip install --user -r requirements.txt && \ + pip uninstall -y pip wheel && \ + apk del gcc musl-dev && \ + python3 -m compileall -b -f /root/.local/lib/python3.11/site-packages && \ + find /root/.local/lib/python3.11/site-packages -name "*.py" -type f -delete && \ + find /root/.local/lib/python3.11/ -name "__pycache__" -type d -exec rm -rf {} + + +FROM base ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor COPY requirements.txt . -RUN pip install --upgrade pip wheel && \ - pip install -r requirements.txt && \ - pip uninstall -y pip wheel && \ - python3 -m compileall -b -f /usr/local/lib/python3.11/site-packages && \ - find /usr/local/lib/python3.11/site-packages -name "*.py" -type f -delete && \ - find /usr/local/lib/python3.11/ -name "__pycache__" -type d -exec rm -rf {} + +COPY --from=dep_installer /root/.local /root/.local WORKDIR /app