Gitlab-ci: build go app with docker as a docker image

Preparations

[TO BE UPDATED LATER]

My gitlab-ci.yml

My Dockerfile

Pulling from your private registry

Create deploy token as described here.
After that, you can do this:

Useful links:
https://dev.to/hypnoglow/how-to-make-friends-with-golang-docker-and-gitlab-ci-4bil
https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
https://medium.com/@tonistiigi/advanced-multi-stage-build-patterns-6f741b852fae
https://docs.gitlab.com/ee/ci/yaml/ (full description of gitlab-ci.yml)
https://about.gitlab.com/blog/2017/11/27/go-tools-and-gitlab-how-to-do-continuous-integration-like-a-boss/
https://gitlab.com/hypnoglow/example-go-docker-gitlab/blob/master/.gitlab-ci.yml
Somewhat useful:
https://blog.lwolf.org/post/how-to-build-tiny-golang-docker-images-with-gitlab-ci/
https://angristan.xyz/build-push-docker-images-gitlab-ci/
https://docs.gitlab.com/ee/user/packages/container_registry/#use-images-from-gitlab-container-registry
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-centos-7 (it says to do sudo usermod -aG docker username to avoid sudo on every docker command invokation)
https://gitlab.com/[username_for_gitlab]/[project_name]/-/ci/lint (validate your gitlab-ci.yml)
https://blog.boatswain.io/post/build-go-project-with-gitlab-ci/

LEAVE A COMMENT