From c61b6a39899fffaa1d4b194dc63bc0779644350c Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Sat, 23 Mar 2024 12:59:02 +0100 Subject: [PATCH] Build docker and publish docker image in CI --- .forgejo/workflows/publish-docker.yml | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .forgejo/workflows/publish-docker.yml diff --git a/.forgejo/workflows/publish-docker.yml b/.forgejo/workflows/publish-docker.yml new file mode 100644 index 0000000..9afe0b4 --- /dev/null +++ b/.forgejo/workflows/publish-docker.yml @@ -0,0 +1,36 @@ +name: Publish Docker image + +on: + push: + branches: + - 'main' + +jobs: + push_to_registry: + name: Push Docker image to local registry + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: setup buildx + uses: https://github.com/docker/setup-buildx-action@v2 + + - name: Log in to local registry + run: | + BASE64_AUTH=`echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64` + mkdir -p ~/.docker + echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json + env: + CI_REGISTRY: https://git.kallestruik.nl + CI_REGISTRY_USER: ${{ secrets.FORGEJO_USERNAME }} + CI_REGISTRY_PASSWORD: ${{ secrets.FORGEJO_PASSWORD }} + + - name: Build and push Docker image + uses: https://github.com/docker/build-push-action@v4 + with: + context: . + push: true + tags: "git.kallestruik.nl/kalle/esl-docker:latest"