Skip to content

Commit

Permalink
Fix docker image tag (remove invalid chars)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleyvega committed Aug 11, 2020
1 parent 4e5ae71 commit a8af71a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
24 changes: 16 additions & 8 deletions .drone-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,25 @@ steps:
DOCKER_HOST: unix:///run/docker.sock
DOCKER_CONFIG_JSON:
from_secret: dockerconfig
# shell: /bin/bash
commands:
- find cmd -name "*-linux-amd64" -print | while read -r binary ; do cp -a "$$binary" "$${binary//-linux-amd64/}" ; done
- make docker
- mkdir -p docker/bin
- find cmd -maxdepth 1 -and -not -name cmd | sed -e 's#^cmd/##' | while read -r app ; do
cp -a "cmd/$$app/$$app-linux-amd64" "docker/bin/$$app" || exit 1 ;
done
- tmptag="$$(openssl rand -hex 10)"
- docker build -t "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" docker/
- rm -rf docker/bin
- mkdir -p "$$HOME/.docker" ; echo "$$DOCKER_CONFIG_JSON" >"$$HOME/.docker/config.json" ; unset DOCKER_CONFIG_JSON
- tag="$$(bash -c 'source script/build.sh && set_version && echo "$$version"')"
- docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$tag"
- if test -n "$$DRONE_TAG" ; then
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_TAG" ;
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_TAG" ;
fi
- if test -n "$$DRONE_BRANCH" ; then
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_BRANCH" ;
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$DRONE_BRANCH" ;
sanitised_branch="$$(echo -n "$$DRONE_BRANCH" | tr -c 'A-Za-z0-9._' '-')"
docker tag "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag" "docker.pkg.github.com/vegaprotocol/vega/vega:$$sanitised_branch" ;
docker push "docker.pkg.github.com/vegaprotocol/vega/vega:$$sanitised_branch" ;
fi
- docker rmi "docker.pkg.github.com/vegaprotocol/vega/vega:$$tmptag"
depends_on:
- build-branch
when:
Expand Down Expand Up @@ -292,7 +300,7 @@ steps:
- unset GITHUB_DEPLOY_SSH_PRIVATE_KEY
- ./script/build.sh -a build -T
depends_on:
- build-branch
- build_docker_image
when:
event: tag

Expand Down
16 changes: 0 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,6 @@ print_check: ## Check for fmt.Print functions in Go code
rm -f "$$f" && \
if test "$$count" -gt 0 ; then exit 1 ; fi

.PHONY: docker
docker: SHELL:=/usr/bin/env bash
docker: ## Make docker container image using pre-existing binaries
@source ./script/build.sh && set_version && \
mkdir -p docker/bin && \
for app in "$${apps[@]}" ; do \
f="cmd/$$app/$$app" ; \
if ! test -f "$$f" ; then \
echo "Failed to find: $$f" ; \
exit 1 ; \
fi ; \
cp -a "$$f" docker/bin/ || exit 1 ; \
done && \
docker build -t "docker.pkg.github.com/vegaprotocol/vega/vega:$$version" docker && \
rm -rf docker/bin

.PHONY: gettools_build
gettools_build:
@./script/gettools.sh build
Expand Down

0 comments on commit a8af71a

Please sign in to comment.