Improved docker build process

This commit is contained in:
Mike Farah 2018-10-25 17:49:46 +11:00
parent 90fe9c6512
commit 785ee68a76
3 changed files with 14 additions and 1 deletions

View File

@ -16,9 +16,12 @@ RUN CGO_ENABLED=0 make local build
# Choose alpine as a base image to make this useful for CI, as many
# CI tools expect an interactive shell inside the container
FROM alpine:3.7
FROM alpine:3.7 as production
COPY --from=builder /go/src/mikefarah/yq/yq /usr/bin/yq
RUN chmod +x /usr/bin/yq
ARG VERSION=none
LABEL version=${VERSION}
WORKDIR /workdir

View File

@ -25,6 +25,7 @@
- docker
- build and push latest and new version tag
- docker build . --arg -t mikefarah/yq:latest -t mikefarah/yq:VERSION
- debian package
- execute

9
scripts/publish-docker.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
set -ex
VERSION="$(git describe --tags --abbrev=0)"
docker build \
--target production \
--build-arg VERSION=${VERSION} \
-t mikefarah/yq:latest \
-t mikefarah/yq:${VERSION} \
.