-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
1d73d3e
commit e105893
Showing
3 changed files
with
68 additions
and
19 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,19 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
tags: [ "v*" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build the Docker image | ||
run: beta/docker-build.sh test |
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 |
---|---|---|
@@ -1,9 +1,39 @@ | ||
#!/bin/sh -ex | ||
#!/bin/bash -e | ||
# Copyright 2024 The Board of Trustees of the University of Illinois | ||
|
||
TAG=ghcr.io/iti/pcesapps-beta:v0.1.1 | ||
TAG2=ghcr.io/iti/pcesapps-beta:latest | ||
cp ../go.mod ../go.sum . | ||
docker build --no-cache -t $TAG -t $TAG2 . | ||
docker push $TAG | ||
docker push $TAG2 | ||
# Usage: docker-build.sh [suffix [version ...]] | ||
# Builds a docker image | ||
# and pushes it with the tags | ||
# ghcr.io/iti/pocesapps-$suffix:$version1 | ||
# ghcr.io/iti/pocesapps-$suffix:$version2 | ||
# ... | ||
# The default value of "$suffix" is test. | ||
# Additionally, versions of $(date) and "latest" | ||
# are always created | ||
# | ||
# To test your code from the command line: | ||
# ./docker-build.sh | ||
# ./docker-run.sh | ||
# That creates ghcr.io.iti/pcesapps-test:latest | ||
# | ||
# Whenever you git push a branch, the ci/cd runs: | ||
# ./docker-build.sh dev | ||
# This creates ghcr.io/iti/pcesappos-dev:latest | ||
# | ||
# Whever your git push a tag, the ci/cd runs: | ||
# ./docker-build.shy beta $tag | ||
# This creates ghcr.io/iti/pcesapps-beta:$tag | ||
|
||
pfx="ghcr.io/illinoisadams/doc-test" | ||
pfx="ghcr.io/iti/pcesapps" | ||
|
||
now=$(date -u +%F-%H-%M-%S) | ||
image="$pfx-"${1:-"test"} | ||
latest=( ${1:+"latest"} "$@" ) | ||
|
||
docker build --no-cache -t "$image:$now" . | ||
docker push "$image:$now" | ||
for v in "${latest[@]}" ; do | ||
docker tag "$image:$now" "$image:$v" | ||
docker push "$image:$v" | ||
done |