diff --git a/.github/workflows/base.yml b/.github/workflows/build-base-image.yml similarity index 64% rename from .github/workflows/base.yml rename to .github/workflows/build-base-image.yml index de2cf57..3f2fe67 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/build-base-image.yml @@ -18,11 +18,19 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push + - name: Build and push runtime uses: docker/build-push-action@v4 with: context: . - file: ./Dockerfile.base + file: ./Dockerfile.runtime platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:${{ github.ref_name }}, ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:base + tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:${{ github.ref_name }}, ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:runtime + - name: Build and push builder + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile.builder + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:${{ github.ref_name }}, ${{ secrets.DOCKERHUB_USERNAME }}/xiaomusic:builder diff --git a/Dockerfile b/Dockerfile index d5a7d44..01978bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10 AS builder +FROM hanxi/xiaomusic:builder AS builder ENV DEBIAN_FRONTEND=noninteractive RUN pip install -U pdm ENV PDM_CHECK_UPDATE=false @@ -9,7 +9,7 @@ COPY plugins/ ./plugins/ COPY xiaomusic.py . RUN pdm install --prod --no-editable -FROM hanxi/xiaomusic:base +FROM hanxi/xiaomusic:runtime WORKDIR /app COPY --from=builder /app/.venv /app/.venv diff --git a/Dockerfile.builder b/Dockerfile.builder new file mode 100644 index 0000000..82c0b7b --- /dev/null +++ b/Dockerfile.builder @@ -0,0 +1,11 @@ +FROM python:3.10 +ENV DEBIAN_FRONTEND=noninteractive +RUN pip install -U pdm +ENV PDM_CHECK_UPDATE=false +WORKDIR /app +COPY pyproject.toml README.md . +COPY xiaomusic/ ./xiaomusic/ +COPY plugins/ ./plugins/ +COPY xiaomusic.py . +RUN pdm install --prod --no-editable + diff --git a/Dockerfile.base b/Dockerfile.runtime similarity index 94% rename from Dockerfile.base rename to Dockerfile.runtime index 0574c1f..0a2779f 100644 --- a/Dockerfile.base +++ b/Dockerfile.runtime @@ -3,6 +3,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ wget \ + xz-utils \ libtiff6 \ libopenjp2-7 \ libxcb1 \