1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

allows extra copies in the docker image

This commit is contained in:
Carlos Alexandro Becker 2017-09-25 19:10:04 -03:00
parent 0670a21441
commit bd7e503961
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 17 additions and 7 deletions

View File

@ -161,13 +161,14 @@ type Checksum struct {
// Docker image config // Docker image config
type Docker struct { type Docker struct {
Binary string `yaml:",omitempty"` Binary string `yaml:",omitempty"`
Goos string `yaml:",omitempty"` Goos string `yaml:",omitempty"`
Goarch string `yaml:",omitempty"` Goarch string `yaml:",omitempty"`
Goarm string `yaml:",omitempty"` Goarm string `yaml:",omitempty"`
Image string `yaml:",omitempty"` Image string `yaml:",omitempty"`
Dockerfile string `yaml:",omitempty"` Dockerfile string `yaml:",omitempty"`
Latest bool `yaml:",omitempty"` Latest bool `yaml:",omitempty"`
Files []string `yaml:"extra_files,omitempty"`
// Capture all undefined fields and should be empty after loading // Capture all undefined fields and should be empty after loading
XXX map[string]interface{} `yaml:",inline"` XXX map[string]interface{} `yaml:",inline"`

View File

@ -52,6 +52,10 @@ dockers:
dockerfile: Dockerfile dockerfile: Dockerfile
# Also tag and push myuser/myimage:latest # Also tag and push myuser/myimage:latest
latest: true latest: true
# If your dockerfile copies more files other than the binary itself,
# you should list them here as well.
extra_files:
- config.yml
``` ```
These settings should allow you to generate multiple docker images, using These settings should allow you to generate multiple docker images, using

View File

@ -71,6 +71,11 @@ func process(ctx *context.Context, folder string, docker config.Docker, binary c
if err := os.Link(docker.Dockerfile, dockerfile); err != nil { if err := os.Link(docker.Dockerfile, dockerfile); err != nil {
return errors.Wrap(err, "failed to link dockerfile") return errors.Wrap(err, "failed to link dockerfile")
} }
for _, file := range docker.Files {
if err := os.Link(file, filepath.Join(root, filepath.Base(file))); err != nil {
return errors.Wrapf(err, "failed to link extra file '%s'", file)
}
}
if err := dockerBuild(root, dockerfile, image); err != nil { if err := dockerBuild(root, dockerfile, image); err != nil {
return err return err
} }