M
M
Micro Null2017-10-18 08:03:10
go
Micro Null, 2017-10-18 08:03:10

What is the practice for deploying Golang projects?

I haven’t come across this yet and I want to know in advance what are the practices for deploying applications in Golang?
The question is confusing because Golang initially has binary distribution. Those. in theory, one ready-made binary is meant to be thrown onto the host and it's done.
There are certain disadvantages associated with the size of the binary itself, and as you know, Golang has decent ones.
For myself, I more imagine deployment through containers with automatic assembly of binaries already on the host, inside the container. So that he himself downloads the code from the git repository, runs the tests and builds.
Are there ready-made tools for this, so as not to fence bicycles?
Well, I would like to read the answers of people who already have experience in practice.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RidgeA, 2017-10-18
@micronull

collecting a binary in production is a so-so idea.
even the 1.9-alpine image takes 83 meters + there will be dependencies in GOPATH
I did the following
In GitLab CI, a task was created to test the project, build it into a binary and create a docker image FROM: SCRATCH, where ONLY this binary is located.
At the input, I received an image the size of a binary - without dependencies in GOPATH and the build environment - about 15 mb.
There are nuances for building such a binary, but in most cases IMHO they are not essential.
+ The disadvantage of this approach is that you can’t just get into the container and execute some bash command, because there is nothing at all, except for the binaries.
here is the article. https://blog.codeship.com/building-minimal-docker-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question