Files for the 2018-02-27 Docker talk of the meta (Golang/Modern Devops) Paris meetup.
Here is the infamouse Prezi presentation : https://prezi.com/p/2-kdk2x0pnfy/
- A standard docker image with the default Golang image
- Reordered Dockerfile to benefit cache
- The
onbuild
special image - Choose the file to add or use .dockerignore
- The
golang:alpine
image - Only add the binary to the image
- Use docker multi-stage to build the binary and keep it in the final image
- Use docker multi-stage to build multiple versions of an image
- Create your own base image to avoid RUN steps (not cached)
For each step, you can build the image with :
docker build -t <image name> -f <step directory>/Dockerfile .
For example :
docker build -t meetup3 -f 3.onbuild/Dockerfile .
Once built, you can run the image :
docker run --rm -ti -p 8080:8080 meetup6
# In another terminal
curl -si http://127.0.0.1:8080
For the step 8 :
# Build the production image
docker build --target=production -t meetup8:production -f 8.multiple_versions/Dockerfile .
# Build the debug image
docker build --target=debug -t meetup8:debug -f 8.multiple_versions/Dockerfile .
The debug image must be launch with :
docker run --rm -ti -p 8080:8080 -p 2345:2345 --security-opt=seccomp:unconfined meetup8:debug
Then you can remote debug with VSCode !