1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

docker docs

refs https://github.com/goreleaser/goreleaser/issues/320
This commit is contained in:
Carlos Alexandro Becker 2017-09-12 22:16:23 -03:00
parent 3f57510723
commit 6229468d11
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 58 additions and 1 deletions

View File

@ -1,5 +1,5 @@
---
title: Snapcraft
title: Snapcraft packaging
---
GoReleaser can generate `snap` packages. [Snaps](http://snapcraft.io/) are a

57
docs/130-docker.md Normal file
View File

@ -0,0 +1,57 @@
---
title: Docker Support
---
Since [v0.31.0](https://github.com/goreleaser/goreleaser/releases/tag/v0.31.0),
[GoReleaser](https://github.com/goreleaser/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`:
```yaml
dockers:
- image: user/repo
```
You also need to create a `Dockerfile` in your repo root folder:
```dockerfile
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:
```yaml
# .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
```
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.