Skip to content
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

added dockerfile and multiarch build job in goreleaser workflow. fixe… #1868

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,30 @@ jobs:
args: release --clean
env:
GITHUB_TOKEN: ${{secrets.GH_PAT}}

docker:
runs-on: ubuntu-latest
needs: goreleaser

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason we need to wait for the goreleaser job? I don't see any hard dependency and we could save some time by executing these jobs in parallel

if: ${{ secrets.DOCKER_HUB_USERNAME && secrets.DOCKER_HUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Build and Push Docker image
uses: docker/build-push-action@v6
platforms: linux/amd64,linux/arm64
with:
context: .
file: ./Dockerfile
push: true
tags: |
go-task/task:latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this workflow is triggered on tag creation, it would be a good idea to tag the created image with the version tag that was created in git. That way we can have matching tags for the docker images and the git repo.

We can still leave in a latest tag, but I consider actual version tags to be a requirement to properly use this image

9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.23.2-alpine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would technically only be the build stage. For the final "production" stage, there is no need to have golang as a base. We could do alpine or something smaller


COPY . /app

WORKDIR /app

RUN /app/install-task.sh -b /usr/local/bin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main gripe with this is that is is, at least as far as I understand, quite impossible for docker to cache any layers to speed up builds.


ENTRYPOINT ["task"]