docker-in-docker with golang compiler
271
This is a single container with docker and golang to build golang binaries and pack them into docker containers straight away
The main is to combine golang and docker in one container to be able to compile golang project and build a container with it in a single run during Gitlab's CI, specifying this image as a base image for a stage in .gitlab-ci.yml. On the other hand, it can be used anywhere.
Usage example: you can write a script like this:
#!/bin/sh
mkdir build && cp ./Dockerfile ./build/Dockerfile && cd build && go build -o my-app .. && docker build . -t my-app && docker push my-app
place it in your repo and execute something like:
docker run -P --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd):/go/src/github.com/my-golang-test coldze/docker-golang \
/bin/sh -c "cd /go/src/github.com/my-golang-test && ./build.sh"
Content type
Image
Digest
Size
153.7 MB
Last updated
almost 8 years ago
docker pull coldze/docker-golang