-
Notifications
You must be signed in to change notification settings - Fork 21
Automatically build and publish container images to Github Container Repo #23
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
base: master
Are you sure you want to change the base?
Changes from all commits
ff1c940
2bca1fd
9606a46
b3c8a53
b506e30
0aabf02
2dc2a4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: "Container image build" | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master ] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
|
|
||
| image: | ||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to the Container registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=raw,value={{date 'YYYY-MM-DDTHH-mm'}} | ||
| type=raw,value=latest | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: ${{ github.ref == 'refs/heads/master' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||||
| FROM docker.io/golang:bookworm AS builder | ||||||||||||||||
|
|
||||||||||||||||
| WORKDIR src | ||||||||||||||||
|
|
||||||||||||||||
| COPY *.go ./ | ||||||||||||||||
| COPY processors/ ./processors/ | ||||||||||||||||
|
|
||||||||||||||||
| RUN go mod init gtfstidy | ||||||||||||||||
| RUN go mod tidy | ||||||||||||||||
| RUN go build . | ||||||||||||||||
|
|
||||||||||||||||
| FROM docker.io/debian:stable-slim | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add OCI annotations, to provide helpful machine-readable infos to a variety of tools.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. docker/metadata-action actually already adds most (all?) of these labels from the GitHub metadata. Can you check the pfaedle image (which uses the same process) to see if you're missing something? https://github.com/ad-freiburg/pfaedle/pkgs/container/pfaedle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I didn't know. Consider this thread irrelevant then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A smaller base image would be better. Ideally only the binary and tzdata. |
||||||||||||||||
|
|
||||||||||||||||
| COPY --from=builder /go/src/gtfstidy /usr/local/bin/gtfstidy | ||||||||||||||||
|
|
||||||||||||||||
| ENTRYPOINT ["/usr/local/bin/gtfstidy"] | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move entrypoint above for a better use of layers, as the binary changes more often. |
||||||||||||||||
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.
go.modandgo.sumare missing.This will allow to remove the
go modcommands below.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.
Thanks for the review. However I'm a little reluctant to work on this as this PR has been open for a while and I've not received any feedback from the repo owner.