feat(container): restructure Containerfile with three build targets#3163
Open
ogarcia wants to merge 1 commit into
Open
feat(container): restructure Containerfile with three build targets#3163ogarcia wants to merge 1 commit into
ogarcia wants to merge 1 commit into
Conversation
Replace the single Dockerfile with a Containerfile supporting three flavors:
- gh-release (default): downloads a pre-built binary from GitHub releases,
based on gcr.io/distroless/cc-debian12
- distroless: builds musl-dynamic binary from source, based on scratch
(includes runtime musl libraries)
- alpine: builds musl-dynamic binary from source, based on alpine:3.21
Usage:
docker build . # gh-release
docker build --target distroless . # scratch
docker build --target alpine . # alpine
docker build --target gh-release \
--build-arg ZOLA_RELEASE_VERSION=v0.22.1 . # specific release
The old Dockerfile is replaced by a symlink for backward compatibility.
The CI workflow builds both distroless and alpine images on tags.
Contributor
Author
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This change slightly modifies how the Zola container is created so that it supports two variants: one distroless and the other based on Alpine Linux closing #2361
Making this change means that Zola is compiled within the container itself in a separate thread instead of being downloaded from releases. This is done to simplify the overall process of creating containers, and since it is only built in releases, it is not a change that will place an excessive load on the system (only recompiles amd64). It is also necessary because the arm64 target with
musldoes not compile in Release-build.Could we explore doing it the other way? Yes, but IMHO this solution is better because it is self-contained and not dependent.
I didn't use the “next” branch because it's separate from the Zola code, and to make sure the build went smoothly, I decided to use a more stable branch.
That said, feel free to tell me to go to hell. 😂