Rework dockerfile and build for armv7

This commit is contained in:
dmunozv04
2024-03-12 22:40:23 +01:00
parent 4dd6aa1c4d
commit 80196b19aa
2 changed files with 19 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ jobs:
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
with: with:
context: . context: .
platforms: linux/amd64, linux/arm64 platforms: linux/amd64, linux/arm64, linux/arm/v7
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,5 +1,7 @@
# syntax=docker/dockerfile:1 # 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 WORKDIR /app
@@ -8,18 +10,26 @@ COPY src .
RUN python3 -m compileall -b -f . && \ RUN python3 -m compileall -b -f . && \
find . -name "*.py" -type f -delete 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 ENV PIP_NO_CACHE_DIR=off iSPBTV_docker=True iSPBTV_data_dir=data TERM=xterm-256color COLORTERM=truecolor
COPY requirements.txt . COPY requirements.txt .
RUN pip install --upgrade pip wheel && \ COPY --from=dep_installer /root/.local /root/.local
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 {} +
WORKDIR /app WORKDIR /app