From cf558a84c51d9b2aaa08fcf029b613e70fbc512c Mon Sep 17 00:00:00 2001 From: cuqmbr Date: Mon, 2 Jun 2025 00:17:43 +0300 Subject: [PATCH] add action to build docker containers --- .github/workflows/build-docker.yml | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 0000000..372db37 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,51 @@ +--- + +on: + push: + branches: + - main + - develop + - feature-42 + +jobs: + build-docker: + runs-on: ubuntu-latest + env: + registry: gitea.cuqmbr.xyz + steps: + - name: Login to Docker Container Registry + uses: docker/login-action@v3 + with: + registry: ${{env.registry}} + username: ${{vars.DOCKER_USER}} + password: ${{secrets.DOCKER_TOKEN}} + # Using instead of checkout action. + # https://gitea.com/gitea/act_runner/issues/164#issuecomment-921571 + - name: Checkout repository + run: | + echo "${{secrets.SSH_PULL_KEY}}" > ssh_key + git init + git remote add origin git@gitea.cuqmbr.xyz:bebrashield/server-survival.git + GIT_SSH_COMMAND="ssh -i ssh_key" git fetch --depth 1 origin ${{ github.ref }} + GIT_SSH_COMMAND="ssh -i ssh_key" git checkout FETCH_HEAD + GIT_SSH_COMMAND="ssh -i ssh_key" git lfs pull + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # token: ${{secrets.PULL_TOKEN}} + # lfs: true + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/arm64,linux/amd64 + push: true + # TODO: split tag names into multiple lines + tags: | + ${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:${{github.sha}} + ${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:latest