Skip to content

Commit

Permalink
Refit Docker build to match our current demands
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed Nov 4, 2017
1 parent 0ce9142 commit 368d193
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ script:
- make blackbox-integration-test
- make lint
- make vet
- make docker

after_success:
- if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then make release; fi
Expand Down
20 changes: 12 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# This file is a template, and might need editing before it works on your project.
FROM golang:1.8-alpine AS builder
# We'll likely need to add SSL root certificates
RUN apk --no-cache add ca-certificates
# Missing part for compiling the application by it self because it requires a sock
#
# NB! This file is a template and might need editing before it works on your project!
#
FROM golang:1.8 AS builder
WORKDIR /go/src/github.com/ivanilves/lstags
COPY . ./
RUN ln -nfs /bin/bash /bin/sh && make assemble
FROM scratch
# Since we started from scratch, we'll copy the SSL root certificates from the builder
# Since we started from scratch, we'll copy following from the builder:
# * SSL root certificates bundle
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY lstags /usr/local/bin/lstags
ENTRYPOINT [ "/usr/local/bin/lstags" ]
# * compiled lstags binary
COPY --from=builder /go/src/github.com/ivanilves/lstags/lstags /lstags
ENTRYPOINT [ "/lstags" ]
CMD ["--help"]
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ all: prepare dep test lint vet build

offline: unit-test lint vet build

assemble: prepare dep lint vet build

prepare:
go get -u -v \
github.com/golang/dep/cmd/dep \
Expand Down Expand Up @@ -69,10 +71,10 @@ shell-test-push-local:
./lstags localhost:${REGISTRY_PORT}/qa/library/alpine
${MAKE} --no-print-directory stop-local-registry

lint: ERRORS:=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -i golint {} | tr '`' '|')
lint: ERRORS=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -i golint {} | tr '`' '|')
lint: fail-on-errors

vet: ERRORS:=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -i go tool vet {} | tr '`' '|')
vet: ERRORS=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -i go tool vet {} | tr '`' '|')
vet: fail-on-errors

fail-on-errors:
Expand Down Expand Up @@ -121,6 +123,7 @@ deploy:
GITHUB_TOKEN=${GITHUB_TOKEN} ./scripts/github-create-release.sh ./dist/release
GITHUB_TOKEN=${GITHUB_TOKEN} ./scripts/github-upload-assets.sh ${TAG} ./dist/assets

docker: DOCKER_REPO:=ivanilves/lstags
docker: RELEASE_TAG:=latest
docker:
@docker container run -v $(shell pwd):/go/src/github.com/ivanilves/lstags -w /go/src/github.com/ivanilves/lstags -v /var/run/docker.sock:/var/run/docker.sock golang:1.8 scripts/prepare-docker-build.sh
@docker image build -t ivanilves/lstags .
@docker image build -t ${DOCKER_REPO}:${RELEASE_TAG} .
5 changes: 0 additions & 5 deletions scripts/prepare-docker-build.sh

This file was deleted.

0 comments on commit 368d193

Please sign in to comment.