1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-27 01:33:39 +02:00

feat: docker in docker support (#785)

* feat: docker in docker support

* fix: pr comments
This commit is contained in:
Igor German 2018-09-04 15:19:01 +03:00 committed by Carlos Alexandro Becker
parent e6f24ee5f5
commit 99a9da4c3b
4 changed files with 26 additions and 8 deletions

View File

@ -1,7 +1,12 @@
FROM golang:1.10
RUN apt-get update && \
apt-get install -y rpm git && \
apt-get install -y rpm git apt-transport-https curl gnupg2 software-properties-common && \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" && \
apt-get update && apt-get install -y docker-ce &&\
rm -rf /var/lib/apt/lists/*
COPY goreleaser /goreleaser
ENTRYPOINT ["/goreleaser"]
COPY goreleaser /bin/goreleaser
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "-h" ]

8
entrypoint.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
if [ -n $DOCKER_USERNAME ] && [ -n $DOCKER_PASSWORD ]; then
echo "Login to the docker..."
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
fi
goreleaser $@

View File

@ -100,10 +100,11 @@ func doRun(ctx *context.Context) error {
}
func process(ctx *context.Context, docker config.Docker, artifact artifact.Artifact) error {
tmp, err := ioutil.TempDir("", "goreleaserdocker")
tmp, err := ioutil.TempDir(ctx.Config.Dist, "goreleaserdocker")
if err != nil {
return errors.Wrap(err, "failed to create temporaty dir")
}
defer os.RemoveAll(tmp)
log.Info("tempdir: " + tmp)
// nolint:prealloc
var images []string

View File

@ -42,13 +42,17 @@ scoop install goreleaser
### Using Docker
You can use Docker to do simple releases. Currently, the provided docker
image does not provide support for docker-in-docker and snapcraft.
image does not provide support for snapcraft.
```console
$ docker run \
$ docker run --rm --privileged \
-v $PWD:/go/src/github.com/user/repo \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/user/repo \
goreleaser/goreleaser --help
-e GITHUB_TOKEN \
-e DOCKER_USERNAME \
-e DOCKER_PASSWORD \
goreleaser/goreleaser release
```
Note that the image will almost always have the last stable Go version.