-
Notifications
You must be signed in to change notification settings - Fork 20
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
Docker image don't include commit hash #72
Comments
Checked the CI logs: #11 18.86 go build -ldflags="-X 'github.com/rramiachraf/dumb/data.Version=`git rev-parse --short HEAD`' -s -w"
#11 18.86 fatal: not a git repository (or any of the parent directories): .git It seems .git directory is not copied or non existent in builder |
We need to include .git folder so the build includes the git hash. We can achieve this by building with BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 Or we can use |
So we basically need to update CI to use this build argument. This is probably looks like this: - name: Build and push platform specific images
uses: docker/build-push-action@v6
with:
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ matrix.platform }}
tags: ${{ steps.image-metadata.outputs.tags }}
build-args:
- BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 Or we can use context in as stated here. And add to Dockerfile remove instruction after 22nd line: RUN rm -r .git I am not sure if these are the ideal ways to solve it. I think the best way is only to replace |
And in this case it would be great to update the Go version and dependencies. I've tried rewriting the Docker image to use Debian based version of Go since this is what go devs recommend because this is what they tell about alpine based images:
but in the end it was too much hassle and I needed to rewrite the Makefile, since dash (Debian default shell) was failing on &>, also needed to statically link the binary since it was linking dynamically to the glibc... I think it is okay the way it is right now. I would only update go version, dependencies and removed curl (I guess certificates are needed, in this case we can use ca-certificates instead of curl package) Also, there is trailing space on 9th line in Makefile |
For some reason Dumb Docker image doesn't show its commit hash in the footer.
If Docker image is build locally, it works fine.If build without Docker, it works fine.I'm actually not sure what's the problem, but my instance, https://dumb.hyperreal.coffee/, https://dumb.ducks.party/ seems to experience this problem.
The text was updated successfully, but these errors were encountered: