1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/docs/130-docker.md
2017-09-14 20:16:49 -03:00

1.5 KiB

title
Docker Support

Since v0.31.0, GoReleaser support building and pushing Docker images.

How it works

You can declare multiple Docker images. They will be matched against your the binaries generated by your builds section.

If you have only one build setup, the config is as easy as adding the name of your image to your .goreleaser.yml:

dockers:
  - image: user/repo

You also need to create a Dockerfile in your repo root folder:

FROM scratch
COPY mybin /
ENTRYPOINT ["/mybin"]

This config will build and push a docker image named user/repo:tagname.

Customization

Of course, you can customize a lot of things out of this:

# .goreleaser.yml
dockers:
  # You can have multiple Docker images
  -
    # GOOS of the built binary that should be used
    goos: linux
    # GOARCH of the built binary that should be used
    goarch: amd64
    # GOARM of the built binary that should be used
    goarm: ''
    # Name of the built binary that should be used
    binary: mybinary
    # Docker image name
    image: myuser/myimage
    # Path to the Dockerfile (from the project root)
    dockerfile: Dockerfile
    # Also tag and push myuser/myimage:latest
    latest: true

These settings should allow you to generate multiple docker images, using multiple FROM statements, for example, as well generate one image for each binary in your project.