From 6726c3b07e32d1bd1c2da8f6b0ee425b8b2b6783 Mon Sep 17 00:00:00 2001 From: Robert Sachunsky <38561704+bertsky@users.noreply.github.com> Date: Mon, 28 Oct 2024 10:26:58 +0100 Subject: [PATCH] add CD --- .github/workflows/docker.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c09c66c --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,45 @@ +name: Docker Image CI + +on: + push: + branches: [ "master" ] + workflow_dispatch: # run manually + +jobs: + + deploy: + + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + # we need tags for docker version tagging + fetch-tags: true + fetch-depth: 0 + - # Activate cache export feature to reduce build time of images + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERIO_USERNAME }} + password: ${{ secrets.DOCKERIO_PASSWORD }} + - name: Build the Docker image + # build both tags at the same time + run: make docker DOCKER_TAG="docker.io/ocrd/kraken -t ghcr.io/ocr-d/kraken" + - name: Test the Docker image + run: docker run --rm ocrd/kraken ocrd-kraken-segment -h + - name: Push to Dockerhub + run: docker push docker.io/ocrd/kraken + - name: Push to Github Container Registry + run: docker push ghcr.io/ocr-d/kraken