github.com/tomsquest/goreleaser@v0.34.3-0.20171008022654-7d6ef4d338b3/docs/130-docker.md (about) 1 --- 2 title: Docker 3 --- 4 5 Since [v0.31.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.31.0), 6 GoReleaser supports building and pushing Docker images. 7 8 ## How it works 9 10 You can declare multiple Docker images. They will be matched against 11 the binaries generated by your `builds` section. 12 13 If you have only one `build` setup, 14 the configuration is as easy as adding the 15 name of your image to your `.goreleaser.yml` file: 16 17 ```yaml 18 dockers: 19 - image: user/repo 20 ``` 21 22 You also need to create a `Dockerfile` in your project's root folder: 23 24 ```dockerfile 25 FROM scratch 26 COPY mybin / 27 ENTRYPOINT ["/mybin"] 28 ``` 29 30 This configuration will build and push a Docker image named `user/repo:tagname`. 31 32 ## Customization 33 34 Of course, you can customize a lot of things: 35 36 ```yaml 37 # .goreleaser.yml 38 dockers: 39 # You can have multiple Docker images. 40 - 41 # GOOS of the built binary that should be used. 42 goos: linux 43 # GOARCH of the built binary that should be used. 44 goarch: amd64 45 # GOARM of the built binary that should be used. 46 goarm: '' 47 # Name of the built binary that should be used. 48 binary: mybinary 49 # Docker image name. 50 image: myuser/myimage 51 # Path to the Dockerfile (from the project root). 52 dockerfile: Dockerfile 53 # Also tag and push myuser/myimage:latest. 54 latest: true 55 # If your Dockerfile copies files other than the binary itself, 56 # you should list them here as well. 57 extra_files: 58 - config.yml 59 ``` 60 61 These settings should allow you to generate multiple Docker images, 62 for example, using multiple `FROM` statements, 63 as well as generate one image for each binary in your project.