From ee13ff033dc5ebf3b73434ad937bbb73854bc6b0 Mon Sep 17 00:00:00 2001 From: MartaOB <151519478+MartaOB@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:41:01 +0100 Subject: [PATCH] ci: add docker build workflows (#39) * build: add build workflows * fix: dev worflow * fix: prod workflow * ci: remove comment * ci: remove comment --------- Co-authored-by: Ignacio Heredia --- .github/workflows/build-docker-dev.yml | 37 ++++++++++++++++++++++ .github/workflows/build-docker-prod.yml | 42 +++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/build-docker-dev.yml create mode 100644 .github/workflows/build-docker-prod.yml diff --git a/.github/workflows/build-docker-dev.yml b/.github/workflows/build-docker-dev.yml new file mode 100644 index 00000000..db0dacfe --- /dev/null +++ b/.github/workflows/build-docker-dev.yml @@ -0,0 +1,37 @@ +name: Build ai4-papi:dev docker image + +on: workflow_dispatch + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Login to Harbor + uses: docker/login-action@v2 + with: + registry: ${{ secrets.HARBOR_URL }} + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_TOKEN }} + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ secrets.HARBOR_URL }}/ai4os/ai4-papi:dev, ${{ secrets.DOCKERHUB_USERNAME }}/ai4-papi:dev + file: docker/Dockerfile diff --git a/.github/workflows/build-docker-prod.yml b/.github/workflows/build-docker-prod.yml new file mode 100644 index 00000000..b7a11cdd --- /dev/null +++ b/.github/workflows/build-docker-prod.yml @@ -0,0 +1,42 @@ +name: Build ai4-papi:prod docker image + +on: + push: + tags: + - v1.** + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Login to Harbor + uses: docker/login-action@v2 + with: + registry: ${{ secrets.HARBOR_URL }} + username: ${{ secrets.HARBOR_USERNAME }} + password: ${{ secrets.HARBOR_TOKEN }} + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ${{ secrets.HARBOR_URL }}/ai4os/ai4-papi:prod, ${{ secrets.DOCKERHUB_USERNAME }}/ai4-papi:prod + file: docker/Dockerfile +