generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build and publish core images #34
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0a4f587
uncomment for PR test
thetoolsmith 3ab934a
create workflows dir
thetoolsmith 8738c8f
add scheduled run every sunday 5am
thetoolsmith e6fab9a
add unique image tagging, update contributing doc
thetoolsmith 179432e
keep publishing the latest image tags in addition to the build specif…
thetoolsmith 9a2bc05
add push to verify access to ghcr and see default visability
thetoolsmith 09da0d6
cannot set pub/priv at the tag level
thetoolsmith f2969f0
add delete step to remove test package
thetoolsmith 991ada1
add delete step to remove test package
thetoolsmith b8e0f4f
env var syntax debug
thetoolsmith 6e8305f
env var syntax debug
thetoolsmith 1764172
env var syntax debug
thetoolsmith b0ae38a
add notes about deleting the test package
thetoolsmith 10ccff5
change latest to semantic versioning to make immutable
thetoolsmith d484da8
notes about immutable packages
thetoolsmith 458bf3e
typo
thetoolsmith d589cea
remove redundant build, change tagging strategy, notes
thetoolsmith 4bb1d3c
fix markdown
thetoolsmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,65 @@ | ||
name: Build and Publish Base Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: "0 5 * * Sun" | ||
|
||
jobs: | ||
build-publish-image: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: './images' | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Build and Publish alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/alpine:3.18_${{github.run_attempt}} -f Dockerfile-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/alpine:3.18_${{github.run_attempt}} | ||
|
||
docker build -t ghcr.io/cfpb/regtech/sbl/alpine:v3.18.0 -f Dockerfile-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/alpine:v3.18.0 | ||
|
||
- name: 'Build and Publish python-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/python-alpine:3.12_${{github.run_attempt}} -f Dockerfile-python-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/python-alpine:3.12_${{github.run_attempt}} | ||
|
||
docker build -t ghcr.io/cfpb/regtech/sbl/python-alpine:v3.12.0 -f Dockerfile-python-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/python-alpine:v3.12.0 | ||
|
||
- name: 'Build and Publish nginx-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/nginx-alpine:1.27_${{github.run_attempt}} -f Dockerfile-nginx-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/nginx-alpine:1.27_${{github.run_attempt}} | ||
|
||
docker build -t ghcr.io/cfpb/regtech/sbl/nginx-alpine:v1.27.0 -f Dockerfile-nginx-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/nginx-alpine:v1.27.0 | ||
|
||
- name: 'Build and Publish node-js-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/node-js-alpine:3.20_${{github.run_attempt}} -f Dockerfile-node-js-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/node-js-alpine:3.20_${{github.run_attempt}} | ||
|
||
docker build -t ghcr.io/cfpb/regtech/sbl/node-js-alpine:v3.20.0 -f Dockerfile-node-js-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/node-js-alpine:v3.20.0 | ||
|
||
- name: 'Build and Publish python-ubi8 image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/python-ubi8:3.12_${{github.run_attempt}} -f Dockerfile-python-ubi8 . | ||
docker push ghcr.io/cfpb/regtech/sbl/python-ubi8:3.12_${{github.run_attempt}} | ||
|
||
docker build -t ghcr.io/cfpb/regtech/sbl/python-ubi8:v3.12.0 -f Dockerfile-python-ubi8 . | ||
docker push ghcr.io/cfpb/regtech/sbl/python-ubi8:v3.12.0 |
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,57 @@ | ||
name: Build Base Images | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-images: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: './images' | ||
steps: | ||
- name: 'Checkout GitHub Action' | ||
uses: actions/checkout@v4 | ||
|
||
- name: 'Login to GitHub Container Registry' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: 'Build test image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/test:do_not_use -f Dockerfile-alpine . | ||
docker push ghcr.io/cfpb/regtech/sbl/test:do_not_use | ||
|
||
- name: 'Build alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/alpine:3.18_${{github.run_attempt}} -f Dockerfile-alpine . | ||
|
||
- name: 'Build python-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/python-alpine:3.12_${{github.run_attempt}} -f Dockerfile-python-alpine . | ||
|
||
- name: 'Build nginx-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/nginx-alpine:1.27_${{github.run_attempt}} -f Dockerfile-nginx-alpine . | ||
|
||
- name: 'Build node-js-alpine image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/node-js-alpine:3.20_${{github.run_attempt}} -f Dockerfile-node-js-alpine . | ||
|
||
- name: 'Build python-ubi8 image' | ||
run: | | ||
docker build -t ghcr.io/cfpb/regtech/sbl/python-ubi8:3.12_${{github.run_attempt}} -f Dockerfile-python-ubi8 . | ||
|
||
# Github api reference only. | ||
# We would need to use a dedicted user PAT since auto-generated GITHUB_TOKEN is not org admin which is required for delete | ||
|
||
# - name: 'Delete test package' | ||
# run: | | ||
# curl -L -X DELETE -H "Accept: application/vnd.github+json" -H "Authorization: $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/orgs/cfpb/packages/container/regtech%2Fsbl%2Ftest | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to build twice do we? think we can just build once, and tag and push twice. also, not sure if this has already been discussed but since the convention is having
:latest
as the actual latest tag, what do we think about it being something likeghcr.io/cfpb/.../alpine_3_18_0:latest
andghcr....alpine_3_18_0:${{github.run_attempt}}
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Thanks for catching that, forgot to remove the redundant build. I'll remove that.
As far as using the latest moniker, I hadn't heard anything about using
latest
tag. I was assuming that wasn't desired.However it might be moot because to make packages immutable in GHCR, we have to use semantic versioning which is why I changed the standard tag to that and just added the build specific one so people can pin if they need to.
Immutable packages is not 100% supported yet as it's still in Preview mode, but it does require semantic versioning from what I can tell. I put some references in the
contributing.md
in this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated with both latest and semantic version in addition to a build specific tag. Doesn't hurt to have both ;-)