Skip to content

Commit

Permalink
another try
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbo committed Sep 22, 2023
1 parent a74d8da commit e06774f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,6 @@ jobs:
build_docker_base_images_and_set_env:
name: Build Docker base images and setup environment
runs-on: ubuntu-22.04
env:
BASE_IMAGE_REGISTRY: "europe-west3-docker.pkg.dev/rasa-ci-cd/rasa"
outputs:
base_image_hash: ${{ steps.check_image.outputs.base_image_hash }}
base_mitie_image_hash: ${{ steps.check_image.outputs.base_mitie_image_hash }}
Expand Down Expand Up @@ -870,17 +868,8 @@ jobs:
echo "POETRY_VERSION=$(scripts/poetry-version.sh)" >> $GITHUB_ENV
shell: bash

# Authenticate and push to the release registry
- id: 'auth-release'
name: Authenticate with gcloud for dev registry 🎫
uses: 'google-github-actions/auth@e8df18b60c5dd38ba618c121b779307266153fbf'
with:
credentials_json: '${{ secrets.RASA_OSS_RELEASE_ACCOUNT_KEY }}'

- name: Authenticate docker for dev registry 🎫
run: |
# Set up docker to authenticate via gcloud command-line tool.
gcloud auth configure-docker europe-west3-docker.pkg.dev
- name: Login to DockerHub Registry 🔢
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ env.DOCKERHUB_USERNAME }} --password-stdin || true

- name: Check if tag version is equal or higher than the latest tagged Rasa version
id: rasa_get_version
Expand Down Expand Up @@ -911,26 +900,26 @@ jobs:
BASE_IMAGE_HASH=${{ hashFiles('docker/Dockerfile.base') }}
echo "base_image_hash=${BASE_IMAGE_HASH}" >> $GITHUB_OUTPUT
BASE_IMAGE_EXISTS=$((docker manifest inspect ${BASE_IMAGE_REGISTRY}/rasa:base-${BASE_IMAGE_HASH} &> /dev/null && echo true || echo false) || true)
BASE_IMAGE_EXISTS=$((docker manifest inspect rasa/rasa:base-${BASE_IMAGE_HASH} &> /dev/null && echo true || echo false) || true)
echo "base_exists=${BASE_IMAGE_EXISTS}" >> $GITHUB_OUTPUT
# Base MITIE image
BASE_MITIE_IMAGE_HASH=${{ hashFiles('docker/Dockerfile.base-mitie') }}
MAKEFILE_MITIE_HASH=${{ hashFiles('Makefile') }}
echo "base_mitie_image_hash=${BASE_MITIE_IMAGE_HASH:0:50}-${MAKEFILE_MITIE_HASH:0:50}" >> $GITHUB_OUTPUT
BASE_IMAGE_MITIE_EXISTS=$((docker manifest inspect ${BASE_IMAGE_REGISTRY}/rasa:base-mitie-${BASE_MITIE_IMAGE_HASH:0:50}-${MAKEFILE_MITIE_HASH:0:50} &> /dev/null && echo true || echo false) || true)
BASE_IMAGE_MITIE_EXISTS=$((docker manifest inspect rasa/rasa:base-mitie-${BASE_MITIE_IMAGE_HASH:0:50}-${MAKEFILE_MITIE_HASH:0:50} &> /dev/null && echo true || echo false) || true)
echo "base_mitie_exists=${BASE_IMAGE_MITIE_EXISTS}" >> $GITHUB_OUTPUT
# Base poetry image
BASE_IMAGE_POETRY_EXISTS=$((docker manifest inspect ${BASE_IMAGE_REGISTRY}/rasa:base-poetry-${{ env.POETRY_VERSION }} &> /dev/null && echo true || echo false) || true)
BASE_IMAGE_POETRY_EXISTS=$((docker manifest inspect rasa/rasa:base-poetry-${{ env.POETRY_VERSION }} &> /dev/null && echo true || echo false) || true)
echo "base_poetry_exists=${BASE_IMAGE_POETRY_EXISTS}" >> $GITHUB_OUTPUT
# Base builder image
BASE_IMAGE_BUILDER_HASH=${{ hashFiles('docker/Dockerfile.base-builder') }}-poetry-${{ env.POETRY_VERSION }}
echo "base_builder_image_hash=${BASE_IMAGE_BUILDER_HASH}" >> $GITHUB_OUTPUT
BASE_IMAGE_BUILDER_EXISTS=$((docker manifest inspect ${BASE_IMAGE_REGISTRY}/rasa:base-builder-${BASE_IMAGE_BUILDER_HASH} &> /dev/null && echo true || echo false) || true)
BASE_IMAGE_BUILDER_EXISTS=$((docker manifest inspect rasa/rasa:base-builder-${BASE_IMAGE_BUILDER_HASH} &> /dev/null && echo true || echo false) || true)
echo "base_builder_exists=${BASE_IMAGE_BUILDER_EXISTS}" >> $GITHUB_OUTPUT
- name: Build Docker base image 🛠
Expand Down Expand Up @@ -1031,7 +1020,6 @@ jobs:
needs: [changes, build_docker_base_images_and_set_env]
env:
IMAGE_TAG: ${{ needs.build_docker_base_images_and_set_env.outputs.image_tag }}
BASE_IMAGE_REGISTRY: "europe-west3-docker.pkg.dev/rasa-ci-cd/rasa"
TARGET_IMAGE_REGISTRY: "europe-west3-docker.pkg.dev/rasa-releases/rasa-docker"
BASE_IMAGE_HASH: ${{ needs.build_docker_base_images_and_set_env.outputs.base_image_hash }}
BASE_MITIE_IMAGE_HASH: ${{ needs.build_docker_base_images_and_set_env.outputs.base_mitie_image_hash }}
Expand Down
33 changes: 14 additions & 19 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
variable "BASE_IMAGE_REGISTRY" {
default = "rasa"
}

variable "TARGET_IMAGE_REGISTRY" {
default = "rasa"
}


variable "TARGET_IMAGE_NAME" {
default = "${TARGET_IMAGE_REGISTRY}/rasa"
}

variable "BASE_IMAGE_NAME" {
default = "${BASE_IMAGE_REGISTRY}/rasa"
default = "rasa/rasa"
}

variable "IMAGE_TAG" {
Expand Down Expand Up @@ -95,8 +90,8 @@ target "default" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest",
]
}
Expand All @@ -115,8 +110,8 @@ target "full" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest-full",
]
}
Expand All @@ -135,9 +130,9 @@ target "mitie-en" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-mitie-${BASE_MITIE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-mitie-${BASE_MITIE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest-mitie-en",
]
}
Expand All @@ -155,8 +150,8 @@ target "spacy-de" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest-spacy-de",
]
}
Expand All @@ -174,8 +169,8 @@ target "spacy-it" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest-spacy-it",
]
}
Expand All @@ -193,8 +188,8 @@ target "spacy-en" {
cache-to = ["type=inline"]

cache-from = [
"type=registry,ref=${TARGET_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${BASE_IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${TARGET_IMAGE_NAME}:latest-spacy-en",
]
}

0 comments on commit e06774f

Please sign in to comment.