Build Docker Container #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Docker Container | |
on: [workflow_dispatch] | |
jobs: | |
generate-requirements-txt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: install poetry | |
run: python3 -m pip install poetry | |
- name: install poetry dependencies | |
run: poetry install | |
- name: export requirements.txt | |
run: poetry export --without-hashes -f requirements.txt --output requirements.txt | |
- name: upload requirements.txt | |
uses: actions/upload-artifact@v4 | |
with: | |
name: requirements | |
path: requirements.txt | |
build-and-publish-amd64: | |
runs-on: ubuntu-latest | |
needs: generate-requirements-txt | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Download requirements.txt | |
uses: actions/download-artifact@v4 | |
with: | |
name: requirements | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to ghcr | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build amd64 image | |
run: docker build -t ghcr.io/felix920506/jellychord:latest-amd64 --platform linux/amd64 . | |
- name: push amd64 image | |
run: docker push ghcr.io/felix920506/jellychord:latest-amd64 | |
build-and-publish-arm64: | |
runs-on: ubuntu-24.04-arm | |
needs: generate-requirements-txt | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Download requirements.txt | |
uses: actions/download-artifact@v4 | |
with: | |
name: requirements | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to ghcr | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: build arm64 image | |
run: docker build -t ghcr.io/felix920506/jellychord:latest-arm64 --platform linux/arm64 . | |
- name: push arm64 image | |
run: docker push ghcr.io/felix920506/jellychord:latest-arm64 |