Skip to content

Commit

Permalink
more actions
Browse files Browse the repository at this point in the history
  • Loading branch information
gbiavati committed Jan 30, 2024
1 parent 5918ef3 commit 09587d2
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/build-cads-image-local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build CADS image

on:
workflow_call:
inputs:
deployment_branch:
type: string
required: true
image_name:
type: string
required: true
build_mode:
type: string
required: true
image_tag:
type: string
required: true

jobs:
build-docker-image:
name: Build ${{inputs.image_name}}:${{ inputs.image_tag }} from ${{ inputs.build_mode }}
runs-on: self-hosted
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Login to harbor registry
uses: docker/login-action@v2
with:
registry: '${{ secrets.HARBOR_IP }}'
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Setup docker context for buildx
id: buildx-context
run: docker context create builders || docker context use builders

- name: Create BuildKit Configuration
run: |
cat <<EOF > buildkitd.toml
[registry."${{ secrets.HARBOR_IP }}"]
http = false
insecure = false
ca=["/etc/ssl/certs/ca-certificates.crt"]
EOF
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
endpoint: builders
buildkitd-flags: --debug
config: buildkitd.toml

- name: Checkout cads-deployment repo
uses: actions/checkout@v3
with:
repository: ecmwf-projects/cads-deployment
ref: ${{ inputs.deployment_branch }}
token: ${{ secrets.CADS_PAT }}
path: .

- name: Build and push
uses: docker/build-push-action@v3
with:
context: docker
push: true
tags: ${{ secrets.HARBOR_IP }}/cads/${{ inputs.image_name }}:${{ inputs.image_tag }}
file: docker/${{ inputs.image_name }}/Dockerfile
build-args: |
MODE=${{ inputs.build_mode }}
CADS_PAT=${{ secrets.CADS_PAT }}
GITHUB_TOKEN=${{ secrets.CADS_PAT }}
GITHUB_EMAIL=${{ secrets.EMAIL_GITHUB }}
GITHUB_USERNAME=${{ secrets.USERNAME_GITHUB }}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ on:
jobs:
build_worker:
name: Build worker:${{ inputs.image_tag }} from ${{ inputs.build_mode }}
uses: ecmwf-projects/cads-build-farm/.github/workflows/build-cads-image.yml@main
uses: ecmwf-projects/cads-build-farm/.github/workflows/build-cads-image-local.yml@main
with:
image_name: worker
deployment_branch: ${{ inputs.deployment_branch }}
Expand Down

0 comments on commit 09587d2

Please sign in to comment.