karalabe / xgo

Go CGO cross compiler
MIT License
2.14k stars 280 forks source link

[enhancement] Review of Docker build process #130

Open crazy-max opened 6 years ago

crazy-max commented 6 years ago

Hi @karalabe,

I have forked your repo and made some changes to push images and tags to an unique docker repository to make things more consistent for users.

I use travis and his matrix expansion to build the images instead of using automated builds of Docker Hub (see my .travis.yml).

If you launch a simple travis build, only the base image will be built. If you want to build X images you have to trigger a custom build using this content :

matrix:
  include:
    - name: "xgo 1.10.0"
      env:
        - DOCKERFILE=./docker/go-1.10.0/Dockerfile
        - BUILDPATH=./docker/go-1.10.0
        - VERSION=1.10.0
        - NOT_PUSH_LATEST=true
    - name: "xgo 1.10.1"
      env:
        - DOCKERFILE=./docker/go-1.10.1/Dockerfile
        - BUILDPATH=./docker/go-1.10.1
        - VERSION=1.10.1
        - NOT_PUSH_LATEST=true

matrix:
  include:
    - name: "xgo 1.10.x"
      env:
        - DOCKERFILE=./docker/go-1.10.x/Dockerfile
        - BUILDPATH=./docker/go-1.10.x
        - VERSION=1.10.x
        - NOT_PUSH_LATEST=true

example with Go 1.10 images

image

image

Images and tags are pushed to an unique repository : https://hub.docker.com/r/crazymax/xgo/tags/ I think it would be more consistent if we did the same here.

We can improve more things by using a templating Dockerfile for all images and also launch your testsuite in travis.

What do you think ? Are you interested ?