From 0c8bfacff54b042d055f9f8fec54521a486a981f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20K=C3=A4ldstr=C3=B6m?= Date: Tue, 3 Jan 2017 12:55:46 +0200 Subject: [PATCH] Cleanup and fix some items in the Dockerfile and Makefile. Release 0.3 --- Dockerfile | 15 ++------------- Makefile | 18 +++++++++++------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 704f94df..7e15cab2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,4 @@ -FROM debian:jessie - -RUN apt-get update && apt-get install -y make git apt-utils curl vim gcc - -ENV GO_VERSION 1.6 -RUN curl -fsSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" \ - | tar -xzC /usr/local -ENV PATH /go/bin:/usr/local/go/bin:$PATH -ENV GOPATH /go +FROM golang:1.7 ENV GO_TOOLS_COMMIT 823804e1ae08dbb14eb807afc7db9993bc9e3cc3 # Grab Go's cover tool for dead-simple code coverage testing @@ -31,8 +23,5 @@ RUN set -x \ go build -o /usr/local/bin/registry github.com/docker/distribution/cmd/registry \ && rm -rf "$GOPATH" +# The source is bind-mounted into this folder WORKDIR /go/src/github.com/estesp/manifest-tool - -COPY . /go/src/github.com/estesp/manifest-tool - -RUN go build -o manifest diff --git a/Makefile b/Makefile index 73a74085..6fe515d1 100644 --- a/Makefile +++ b/Makefile @@ -7,30 +7,34 @@ MANINSTALLDIR=${PREFIX}/share/man GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) DOCKER_IMAGE := manifest-tool-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH)) # set env like gobuildtag? -DOCKER_FLAGS := docker run --rm -i #$(DOCKER_ENVS) +DOCKER_RUN := docker run --rm -i #$(DOCKER_ENVS) # if this session isn't interactive, then we don't want to allocate a # TTY, which would fail, but if it is interactive, we do want to attach # so that the user can send e.g. ^C through. INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0) ifeq ($(INTERACTIVE), 1) - DOCKER_FLAGS += -t + DOCKER_RUN += -t endif -DOCKER_RUN_DOCKER := $(DOCKER_FLAGS) "$(DOCKER_IMAGE)" +DOCKER_RUN_DOCKER := $(DOCKER_RUN) -v $(shell pwd):/go/src/github.com/estesp/manifest-tool -w /go/src/github.com/estesp/manifest-tool "$(DOCKER_IMAGE)" -all: binary +all: build + +build: + $(DOCKER_RUN) -v $(shell pwd):/go/src/github.com/estesp/manifest-tool -w /go/src/github.com/estesp/manifest-tool golang:1.7 /bin/bash -c "\ + go build -o manifest-tool github.com/estesp/manifest-tool" binary: - go build -o ${DEST}manifest github.com/estesp/manifest-tool + go build -o manifest-tool github.com/estesp/manifest-tool build-container: docker build ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" . clean: - rm -f manifest + rm -f manifest-tool install: install -d -m 0755 ${INSTALLDIR} - install -m 755 manifest ${INSTALLDIR} + install -m 755 manifest-tool ${INSTALLDIR} shell: build-container $(DOCKER_RUN_DOCKER) bash