Files
Retrieval-based-Voice-Conve…/.github/workflows/docker-push.yml
Andrey Danilov bb2871c1ab Add GitHub Actions workflow for Docker image (#32)
* Add GitHub Actions workflow for pushing Docker images

* Fix invalid case of Docker image tag

* Optimize storage memory consumed by LFS layer

* Force workflow to run `ubuntu-22.04`

* Copy `README.md` to be included in installation with `poetry`

* Fix installation with `poetry`

* Try to optimize runner disk space consumption during build

* Optimize image building on source code changed

* Add verbose logging for downloading assets

* Add logging for disk space at GitHub Actions workflow

* Clean up some disk space usage on Docker image build

* Optimize running `poetry` on Docker image build

* Optimize `pip` taking disk space on Dociker image build

* Try to fix call of clearing `poetry` cache

* Optimize more `poetry` disk space usage

* Try to use Docker image from registry as cache

* Fix `cache-from` and `cache-to` parameters indentation

* Clean up excess workflow steps

* Fix image tag for caching of building Docker image in GitHub Actions workflow

* Disable build image caching for a while

* Remove `docker system prune` step from Docker push workflow

* Revert "Remove `docker system prune` step from Docker push workflow"

This reverts commit 7497fa35b2.

* Hardcode Docker image name

Prevent different naming for the same thing in forks.
2024-07-09 07:45:43 +09:00

43 lines
1.1 KiB
YAML

name: Push Docker image to GitHub Container Registry
on:
push:
tags:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prune Docker System
run: docker system prune -af
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets._GITHUB_PAT }}
- name: Git lowercase repository owner
id: repository-owner-lowercase
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository_owner }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
ghcr.io/${{ steps.repository-owner-lowercase.outputs.lowercase }}/rvc-api:${{ github.ref_name }}
ghcr.io/${{ steps.repository-owner-lowercase.outputs.lowercase }}/rvc-api:latest