Skip to content

Commit

Permalink
Build and publish frontend_nginx from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Oct 5, 2023
1 parent a43f765 commit a108fdc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ jobs:
- name: Build image `${{ matrix.image }}`
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context || matrix.image }}
context: ${{ matrix.context }}
target: ${{ matrix.target }}
push: false
tags: openverse-${{ matrix.image }}
file: ${{ matrix.file }}
cache-from: type=gha,scope=${{ matrix.image }}
cache-to: type=gha,scope=${{ matrix.image }}
outputs: type=docker,dest=/tmp/${{ matrix.image }}.tar
Expand Down
17 changes: 15 additions & 2 deletions automations/python/workflows/set_matrix_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ def ser_set(x):
"api": {"image": "api", "target": "api"},
"api_nginx": {"image": "api_nginx", "context": "api", "target": "nginx"},
"frontend": {"image": "frontend", "target": "app", "build-contexts": "repo_root=."},
"frontend_nginx": {
"image": "frontend_nginx",
"context": "frontend",
"file": "frontend/Dockerfile.nginx",
"target": "nginx",
},
}

if "ci_cd" in changes:
Expand All @@ -46,11 +52,18 @@ def ser_set(x):
build_matrix["image"] |= {"upstream_db", "ingestion_server", "api", "api_nginx"}
publish_matrix["image"] |= {"api", "api_nginx"}
if "frontend" in changes:
build_matrix["image"].add("frontend")
publish_matrix["image"].add("frontend")
build_matrix["image"] |= {"frontend", "frontend_nginx"}
publish_matrix["image"] |= {"frontend", "frontend_nginx"}

build_matrix["include"] = [includes[item] for item in build_matrix["image"]]

for item in build_matrix:
if "context" not in item:
item["context"] = item["image"]

if "file" not in item:
item["file"] = f"{item['context']}/Dockerfile"

do_build = "true" if len(build_matrix["image"]) else "false"
do_publish = "true" if len(publish_matrix["image"]) else "false"
build_matrix = json.dumps(build_matrix, default=ser_set)
Expand Down

0 comments on commit a108fdc

Please sign in to comment.