From a6ab455b4a9e76f230c9a6a14578aa92571eebc0 Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Fri, 26 Jul 2024 15:45:24 +0200 Subject: [PATCH] test docker --- .github/workflows/main.yml | 46 +++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c0cf09..152e062 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,44 @@ -name: Pull request main (workflows) +name: ci on: push: - branches: [main] + branches: + - main + +env: + TEST_TAG: cern-sis/test:latest + LATEST_TAG: cern-sis/test:latest jobs: - build: - runs-on: ubuntu-latest + docker: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: registry.cern.ch + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_PASSWORD }} - steps: - - uses: actions/checkout@v4 + - name: Build and export to Docker + uses: docker/build-push-action@v6 + with: + load: true + tags: ${{ env.TEST_TAG }} - - name: docker build - run: docker build -t my-image . + - name: Test + run: | + docker run --rm ${{ env.TEST_TAG }} - - name: docker run my-image - run: docker run my-image + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.LATEST_TAG }}