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

Add go example #171

Merged
merged 3 commits into from
Jul 23, 2024
Merged

Add go example #171

merged 3 commits into from
Jul 23, 2024

Conversation

jackkleeman
Copy link
Contributor

No description provided.

Comment on lines 1 to 14
FROM golang:1.22-bookworm as builder

WORKDIR /app

COPY go.* ./
RUN go mod download
COPY . ./

RUN CGO_ENABLED=0 go build -v -o server

FROM alpine
COPY --from=builder /app/server /app/server

CMD ["/app/server"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe just use ko for docker images? https://github.com/ko-build/ko

Copy link
Contributor Author

Choose a reason for hiding this comment

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

idk, people can use that if they want but probably a dockerfile is what people are most likely to expect in a template?

Copy link
Contributor

Choose a reason for hiding this comment

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

but probably a dockerfile is what people are most likely to expect in a template?

I can't tell if they would expect a Dockerfile, I think it's sufficient to give people one way to build a container image. The reason I suggested ko is that is so much common those days, it's used even in some of the cncf build pipelines, and it's literally one command to write down in the README. But if you wanna go with the dockerfile, i'm ok with it.

templates/go/main.go Show resolved Hide resolved
templates/go/main.go Outdated Show resolved Hide resolved
.github/workflows/pre-release.yml Outdated Show resolved Hide resolved
@jackkleeman jackkleeman merged commit ece080e into main Jul 23, 2024
3 checks passed
@jackkleeman jackkleeman deleted the golang branch July 23, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants