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

use multistage build to create the container #168

Closed
wants to merge 1 commit into from
Closed

Conversation

freym
Copy link

@freym freym commented Dec 15, 2023

Build a static linked application inside a container

@BuJo
Copy link
Member

BuJo commented Dec 18, 2023

I'm not sure if this interacts favorably with the current release process.
A binary is built in a github action with goreleaser, which builds binaries with built-in version information. It then takes the Dockerfile in the project root to build the resulting image.

As I see it, this would rebuild the go binary without adding the needed ldflags.

Unsure what the usecase is for having the Dockerfile compile the application. Is it to not install a full go sdk on a machine and still build the project?

@BuJo BuJo added enhancement New feature or request question Further information is requested labels Dec 18, 2023
@freym
Copy link
Author

freym commented Dec 18, 2023

This makes it easier to build the image inside a CI Pipeline with tools like kaniko, which runs in a container. (https://github.com/GoogleContainerTools/kaniko)

@BuJo
Copy link
Member

BuJo commented Dec 19, 2023

It would slim down the build-process for certain kinds of builds by one step, however all the caching that is possible by moving the actual build process into its own action/job would somehow have to be replicated and there's still the problem with missing build directives.

The project isn't using any docker packaging system directly, only through goreleaser. goreleaser can use docker or ko. However, we still have a kaniko based release pipeline in https://github.com/synyx/tuwat/blob/main/.gitlab-ci.yml#L89 from the time when it was built and released within a GitLab instance.

Neither one requires building the actual binary from within the Dockerfile, they all can provide the binary via ADD/COPY directives.

I'm still not sure what the actual use-case is here.

@BuJo BuJo closed this Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants