build: 编译镜像

This commit is contained in:
涵曦 2024-10-30 09:50:22 +08:00
parent ac6fbd1b82
commit 8629c16fe4
4 changed files with 25 additions and 5 deletions

View File

@ -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

View File

@ -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

11
Dockerfile.builder Normal file
View File

@ -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

View File

@ -3,6 +3,7 @@ ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
wget \
xz-utils \
libtiff6 \
libopenjp2-7 \
libxcb1 \