Skip to content

Commit

Permalink
cmd/shfmt: add Docker image build files from v2
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Mar 11, 2019
1 parent fac9359 commit a3dcc70
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/shfmt/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
14 changes: 14 additions & 0 deletions release-docker.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a3dcc70

Please sign in to comment.