-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Generic workflow to build a frontend application and push it to the GitHub Container Registry. | ||
name: "Build docker" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# Docker build arg / package name suffix: valid values are "admin-ui" or "ui" | ||
app-name: | ||
required: true | ||
type: string | ||
# Root url for the application relative to hostname | ||
base-url: | ||
required: true | ||
type: string | ||
|
||
env: | ||
SKIP_ENV_VALIDATION: "true" | ||
REGISTRY: "ghcr.io" | ||
|
||
jobs: | ||
build-and-push: | ||
name: "Build and push Docker images to GitHub Packages" | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILD_APP: ${{ inputs.app-name }} | ||
# Relative location for the package registry | ||
REPO_NAME: ${{ github.repository }} | ||
# Have to be build variable | ||
NEXT_PUBLIC_BASE_URL: ${{ inputs.base-url }} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up Docker Buildx" | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: "Log in to the Container registry" | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Repository name needs to be lowercase | ||
- name: "Create repository name" | ||
id: repo | ||
run: >- | ||
echo "repo=$( | ||
echo ${{ env.REGISTRY }}/${{ env.REPO_NAME }}-${{ env.BUILD_APP }} | tr '[:upper:]' '[:lower:]' | ||
)" >> $GITHUB_OUTPUT | ||
- name: "Extract ui metadata (tags, labels) for Docker" | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ steps.repo.outputs.repo }} | ||
tags: | | ||
type=ref,event=tag,priority=3 | ||
type=sha,prefix=,priority=2 | ||
type=ref,event=branch,priority=1 | ||
labels: | | ||
org.opencontainers.image.title=Tilavarauspalvelu UI | ||
org.opencontainers.image.description=Tilavarauspalvelu Customer UI ${{ github.ref_name }} (${{ github.sha }}). | ||
org.opencontainers.image.version=${{ github.ref_name }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
- name: "Build container" | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
build-args: APP=${{ env.BUILD_APP }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
# Use a shared cache to speed up builds | ||
cache-from: type=registry,ref=${{ steps.repo.outputs.repo }}:cache | ||
cache-to: type=registry,ref=${{ steps.repo.outputs.repo }}:cache,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
# Cancel a workflow from the same PR, branch or tag when a new workflow is triggered. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
# required because error pages use build time env vars, not runtime env vars | ||
# it's the same on every environment | ||
EMAIL_VARAAMO_EXT_LINK: "https://lomake.hel.fi/varaamo-palaute" | ||
|
||
jobs: | ||
# Build both ui and admin-ui dockers | ||
build-ui-docker: | ||
name: "Build ui docker" | ||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
app-name: "ui" | ||
base-url: "" | ||
secrets: inherit | ||
|
||
build-admin-ui-docker: | ||
name: "Build admin ui docker" | ||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
app-name: "admin-ui" | ||
base-url: "/kasittely" | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ARG TAG=main | ||
ARG APP=ui | ||
FROM ghcr.io/city-of-helsinki/tilavarauspalvelu-ui-$APP:$TAG AS $APP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters