From 633ed8329d71809ad6916c56c0b3a45b10b9531c Mon Sep 17 00:00:00 2001 From: Felix Delattre Date: Fri, 15 Nov 2024 13:38:08 +0100 Subject: [PATCH] Added CI pipeline to build container and push to registry. --- .github/workflows/deploy-eoapi.yaml | 47 +++++++++++++++++++++++++++++ dockerfiles/Dockerfile.stac | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-eoapi.yaml diff --git a/.github/workflows/deploy-eoapi.yaml b/.github/workflows/deploy-eoapi.yaml new file mode 100644 index 0000000..8b25051 --- /dev/null +++ b/.github/workflows/deploy-eoapi.yaml @@ -0,0 +1,47 @@ +name: build eoapi custom runtime + +on: + workflow_dispatch: + push: + branches: + - main + - develop + paths: + - runtimes/eoapi/** + - .github/workflows/deploy-eoapi.yaml + +jobs: + build: + name: build eoapi stac component + runs-on: "ubuntu-24.04" + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to container registry + uses: azure/docker-login@v1 + with: + login-server: harbor.develop.eoepca.org + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: harbor.develop.eoepca.org/eoapi/stac + tags: | + type=ref,event=branch + type=sha,format=short + latest + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./runtimes/eoapi + file: ./dockerfiles/Dockerfile.stac + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/dockerfiles/Dockerfile.stac b/dockerfiles/Dockerfile.stac index cfcd493..0a1593c 100644 --- a/dockerfiles/Dockerfile.stac +++ b/dockerfiles/Dockerfile.stac @@ -4,7 +4,7 @@ FROM ghcr.io/vincentsarago/uvicorn-gunicorn:${PYTHON_VERSION} ENV CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt -COPY runtimes/eoapi/stac /tmp/stac +COPY ./stac /tmp/stac RUN python -m pip install /tmp/stac RUN rm -rf /tmp/stac