diff --git a/cmd/shfmt/Dockerfile b/cmd/shfmt/Dockerfile new file mode 100644 index 000000000..8b9709367 --- /dev/null +++ b/cmd/shfmt/Dockerfile @@ -0,0 +1,8 @@ +FROM golang:1.12-alpine3.9 + +COPY . /go/src/mvdan.cc/sh +RUN CGO_ENABLED=0 go install -ldflags '-w -s -extldflags "-static"' mvdan.cc/sh/cmd/shfmt + +FROM busybox:1.30.1-musl +COPY --from=0 /go/bin/shfmt /bin/shfmt +ENTRYPOINT ["/bin/shfmt"] diff --git a/release-docker.sh b/release-docker.sh new file mode 100755 index 000000000..41915ba00 --- /dev/null +++ b/release-docker.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +tag=$(git describe --exact-match 2>/dev/null) +if [[ $? != 0 ]]; then + tag=latest +fi + +docker build -t mvdan/shfmt:$tag -f cmd/shfmt/Dockerfile . + +if [[ -n $DOCKER_PASSWORD ]]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +fi + +docker push mvdan/shfmt:$tag