-
Notifications
You must be signed in to change notification settings - Fork 3
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
3 changed files
with
111 additions
and
0 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,48 @@ | ||
name: Prepare Docker Image | ||
description: Prepare Docker Image for CI | ||
inputs: | ||
docker_image_tag_ci: | ||
description: Docker Image Tag for CI | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Prepare for ci | ||
shell: bash | ||
id: prepare-for-ci | ||
run: | | ||
echo "WWWUSER=$(id -u)" >> $GITHUB_ENV | ||
echo "WWWUSER=$(id -u)" >> $GITHUB_OUTPUT | ||
echo "WWWGROUP=$(id -g)" >> $GITHUB_ENV | ||
echo "WWWGROUP=$(id -g)" >> $GITHUB_OUTPUT | ||
- name: Cache Docker Registry | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/docker-registry | ||
key: docker-registry-${{ github.ref }}-${{ github.sha }} | ||
restore-keys: | | ||
docker-registry-${{ github.ref }} | ||
docker-registry- | ||
- name: Boot-up Local Docker Registry | ||
shell: bash | ||
run: docker run -d -p 5000:5000 --restart=always --name registry -v /tmp/docker-registry:/var/lib/registry registry:2 | ||
- name: Wait for Docker Registry | ||
shell: bash | ||
run: npx wait-on tcp:5000 | ||
- name: Get Docker Image Tag | ||
shell: bash | ||
env: | ||
TAG: ${{ inputs.docker_image_tag_ci }} | ||
run: | | ||
echo "DOCKER_IMAGE_TAG_CI=$TAG" >> $GITHUB_ENV | ||
echo TAG $TAG | ||
- name: Docker Compose Pull | ||
shell: bash | ||
run: | | ||
docker pull localhost:5000/jetdisc-ci:${{ inputs.docker_image_tag_ci }} | ||
# - name: List docker images in registry | ||
# shell: bash | ||
# run: | | ||
# curl -X GET http://localhost:5000/v2/_catalog |
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,59 @@ | ||
name: Image build | ||
on: | ||
workflow_call: | ||
outputs: | ||
docker_image_tag_ci: | ||
description: Docker image tag for CI | ||
value: ${{ jobs.image-build.outputs.docker_image_tag_ci }} | ||
workflow_dispatch: | ||
|
||
jobs: | ||
image-build: | ||
runs-on: | ||
- ubuntu-latest | ||
outputs: | ||
docker_image_tag_ci: ${{ steps.generate_docker_image_tag.outputs.docker_image_tag_ci }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cache Docker Build Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: docker-build-cache-${{ github.ref }}-${{ github.sha }} | ||
restore-keys: | | ||
docker-build-cache-${{ github.ref }} | ||
docker-build-cache- | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver-opts: network=host | ||
- name: Generate Docker Image Tag | ||
id: generate_docker_image_tag | ||
run: | | ||
SHA=${{ github.sha }} | ||
TAG=$(TZ=UTC-9 date '+%Y%m')-${SHA:0:7} | ||
echo "DOCKER_IMAGE_TAG_CI=$TAG" >> $GITHUB_ENV | ||
echo TAG $TAG | ||
echo "docker_image_tag_ci=$TAG" >> $GITHUB_OUTPUT | ||
- name: Cache Docker Registry | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/docker-registry | ||
key: docker-registry-${{ github.ref }}-${{ github.sha }} | ||
restore-keys: | | ||
docker-registry-${{ github.ref }} | ||
docker-registry- | ||
- name: Boot-up Local Docker Registry | ||
run: docker run -d -p 5000:5000 --restart=always --name registry -v /tmp/docker-registry:/var/lib/registry registry:2 | ||
- name: Wait for Docker Registry | ||
run: npx wait-on tcp:5000 | ||
- name: Build Docker Image | ||
run: | | ||
docker buildx bake \ | ||
-f 'infra/docker/image-bake.hcl' \ | ||
--builder="${{ steps.buildx.outputs.name }}" \ | ||
--set='app.tags=localhost:5000/jetdisc-ci:${{ steps.generate_docker_image_tag.outputs.docker_image_tag_ci }}' \ | ||
--set='app.platforms=linux/amd64' \ | ||
--push |