diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 0000000..18e1252 --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,51 @@ +name: Publish Docker image + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - + name: Check out the repo + uses: actions/checkout@v3 + - + name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - + name: Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: hibobmaster/matrixchatgptbot + tags: | + type=raw,value=latest + type=ref,event=tag + + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - + name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fbe1d73..d4755fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,13 @@ -FROM python:3.11-alpine as pybuilder +FROM python:3.11-alpine as base + +FROM base as pybuilder RUN sed -i 's|v3\.\d*|edge|' /etc/apk/repositories RUN apk update && apk add olm-dev gcc musl-dev tzdata libmagic COPY requirements.txt /requirements.txt RUN pip3 install --user -r /requirements.txt && rm /requirements.txt -FROM python:3.11-alpine as runner +FROM base as runner LABEL "org.opencontainers.image.source"="https://github.com/hibobmaster/matrix_chatgpt_bot" RUN apk update && apk add olm-dev libmagic COPY --from=pybuilder /root/.local /usr/local