Skip to content

Commit

Permalink
Cleanup and fix some items in the Dockerfile and Makefile. Release 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
luxas committed Jan 3, 2017
1 parent 08f1af2 commit 0c8bfac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
15 changes: 2 additions & 13 deletions 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
Expand All @@ -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
18 changes: 11 additions & 7 deletions Makefile
Expand Up @@ -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
Expand Down

0 comments on commit 0c8bfac

Please sign in to comment.