Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/ci-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: CI - Build base image

on:
workflow_dispatch:
inputs:
version:
description: 'Version tag for base image (e.g., v1.0.0, latest)'
required: true
default: 'latest'

jobs:
build-base:
Expand All @@ -20,8 +25,17 @@ jobs:
docker build . \
--file docker/Dockerfile \
--target emfos-base \
-t ${{ vars.DOCKER_USERNAME }}/emfos-base:latest
docker push ${{ vars.DOCKER_USERNAME}}/emfos-base:latest
-t ${{ vars.DOCKER_USERNAME }}/emfos-base:${{ github.event.inputs.version }}
docker push ${{ vars.DOCKER_USERNAME }}/emfos-base:${{ github.event.inputs.version }}

- name: Conditionally push as latest
shell: bash
run: |
if [[ "${{ github.event.inputs.version }}" == v* ]]; then
docker tag ${{ vars.DOCKER_USERNAME }}/emfos-base:${{ github.event.inputs.version }} \
${{ vars.DOCKER_USERNAME }}/emfos-base:latest
docker push ${{ vars.DOCKER_USERNAME }}/emfos-base:latest
fi

- name: Display Success Message
run: echo "emfos-base image has been built and pushed manually."
run: echo "emfos-base:${{ github.event.inputs.version }} image has been built and pushed manually."
28 changes: 13 additions & 15 deletions .github/workflows/ci-workers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
version:
description: 'Version tag for the release (e.g., v1.0.0)'
required: true
base_image_tag:
description: 'Base image tag to use (e.g., latest, v1.0.0)'
required: true
default: 'latest'

jobs:
build_workers:
Expand All @@ -41,6 +45,7 @@ jobs:
# echo "IMAGE_TAG=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ vars.DOCKER_USERNAME }}/${{ matrix.worker }}" >> $GITHUB_ENV
echo "LATEST_TAG=latest" >> $GITHUB_ENV
echo "BASE_IMAGE_TAG=${{ github.event.inputs.base_image_tag || 'latest' }}" >> $GITHUB_ENV

- name: Compute IMAGE_TAG
id: meta
Expand All @@ -58,33 +63,26 @@ jobs:
fi

echo "IMAGE_TAG=$TAG" >> "$GITHUB_ENV"
echo "Computed IMAGE_TAG=$TAG"
echo "Computed IMAGE_TAG=$TAG with base image tag=${{ env.BASE_IMAGE_TAG }}"

- name: Pull base image or fallback to build
run: |
docker pull ${{ vars.DOCKER_USERNAME }}/emfos-base:latest || \
docker build . \
--file docker/Dockerfile \
--target emfos-base \
-t ${{ vars.DOCKER_USERNAME }}/emfos-base:main
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build worker image
- name: Build worker image with specified base image
run: |
docker build . \
--file docker/Dockerfile \
--target ${{ env.WORKER_NAME }} \
--build-arg BASE_IMAGE=${{ vars.DOCKER_USERNAME }}/emfos-base:${{ env.BASE_IMAGE_TAG }} \
-t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

- name: Tag image as latest
run: |
docker tag ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:${{ env.LATEST_TAG }}

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push versioned image
run: |
docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
Expand Down
19 changes: 12 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Global argument for base image for workers, can be overridden when building with --build-arg
ARG BASE_IMAGE=balticrcc/emfos-base:latest

# Define base container image (platform has to be defined if using with ARM64 architecture)
FROM python:3.11-slim as emfos-base
#FROM --platform=linux/amd64 python:3.11-slim as emfos-base
Expand All @@ -23,7 +26,7 @@
# Set to use interpreter from venv (if venv is used)
#ENV PATH="/.venv/bin:$PATH"

FROM balticrcc/emfos-base:latest as emfos-model-retriever
FROM ${BASE_IMAGE} as emfos-model-retriever

Check warning on line 29 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rx&open=AZ5KhyQo27QeYBePn3Rx&pullRequest=464

Check warning on line 29 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rr&open=AZ5KhyQo27QeYBePn3Rr&pullRequest=464

# Set working directory
WORKDIR /src
Expand All @@ -38,7 +41,7 @@
ENTRYPOINT ["python", "emf/model_retriever/opdm_worker.py"]
#ENTRYPOINT ["/bin/bash"]

FROM balticrcc/emfos-base:latest as emfos-local-model-retriever
FROM ${BASE_IMAGE} as emfos-local-model-retriever

Check warning on line 44 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rs&open=AZ5KhyQo27QeYBePn3Rs&pullRequest=464

Check warning on line 44 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Ry&open=AZ5KhyQo27QeYBePn3Ry&pullRequest=464

# Set working directory
WORKDIR /src
Expand All @@ -52,7 +55,7 @@
ENV PYTHONPATH="${PYTHONPATH}:/src"
ENTRYPOINT ["python", "emf/model_retriever/local_worker.py"]

FROM balticrcc/emfos-base:latest as emfos-model-validator
FROM ${BASE_IMAGE} as emfos-model-validator

Check warning on line 58 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rt&open=AZ5KhyQo27QeYBePn3Rt&pullRequest=464

Check warning on line 58 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rz&open=AZ5KhyQo27QeYBePn3Rz&pullRequest=464

# Set working directory
WORKDIR /src
Expand All @@ -67,7 +70,7 @@
ENTRYPOINT ["python", "emf/model_validator/worker.py"]
#ENTRYPOINT ["/bin/bash"]

FROM balticrcc/emfos-base:latest as emfos-model-merger
FROM ${BASE_IMAGE} as emfos-model-merger

Check warning on line 73 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3R0&open=AZ5KhyQo27QeYBePn3R0&pullRequest=464

Check warning on line 73 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Ru&open=AZ5KhyQo27QeYBePn3Ru&pullRequest=464

# Set working directory
WORKDIR /src
Expand All @@ -82,7 +85,7 @@
ENTRYPOINT ["python", "emf/model_merger/worker.py"]
#ENTRYPOINT ["/bin/bash"]

FROM balticrcc/emfos-base:latest as emfos-task-generator
FROM ${BASE_IMAGE} as emfos-task-generator

Check warning on line 88 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rv&open=AZ5KhyQo27QeYBePn3Rv&pullRequest=464

Check warning on line 88 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3R1&open=AZ5KhyQo27QeYBePn3R1&pullRequest=464

# Set working directory
WORKDIR /src
Expand All @@ -97,14 +100,16 @@
ENTRYPOINT ["python", "emf/task_generator/worker.py"]
#ENTRYPOINT ["/bin/bash"]

# Model Quality image
FROM balticrcc/emfos-base:latest as emfos-model-quality
FROM ${BASE_IMAGE} as emfos-model-quality

Check warning on line 103 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use a specific version tag for the image.

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3Rw&open=AZ5KhyQo27QeYBePn3Rw&pullRequest=464

Check warning on line 103 in docker/Dockerfile

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "as" with upper case format "AS".

See more on https://sonarcloud.io/project/issues?id=Baltic-RCC_EMF&issues=AZ5KhyQo27QeYBePn3R3&open=AZ5KhyQo27QeYBePn3R3&pullRequest=464

# Set working directory
WORKDIR /src

# Copy files to container
COPY emf/model_quality/ ./emf/model_quality/
COPY emf/common/ ./emf/common/
COPY config/ ./config/

# Start process
ENV PYTHONPATH="${PYTHONPATH}:/src"
ENTRYPOINT ["python", "emf/model_quality/worker.py"]
Loading