Daily Archives: 12.10.2019

Postgres in docker: random «unique violation» errors

While running postgres in docker (for development, of course), from time to time I just run into errors like «Duplicate Key Value Violates Unique Constraint». I found the solution (thanks to this answer, for sure — https://stackoverflow.com/a/47089825/801426): if you have a table called «[table]», just do this

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 …

Read more