From ec2295c3dcdb2a9c8e0a07b7934e713542f07359 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 25 Sep 2018 10:33:25 -0700 Subject: [PATCH] Quickly build dev docker images using 'make docker' (#6505) This PR simplifies the process of developer build of local docker containers using `make docker`. You need to provide a TAG i.e ``` TAG=y4m4/minio:exp make docker ``` --- Dockerfile.dev | 23 ++++++++--------------- Makefile | 3 +++ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 73b6cbe20..270210ff2 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,27 +1,20 @@ -FROM golang:1.10.1-alpine3.7 +FROM alpine:3.7 LABEL maintainer="Minio Inc " -ENV GOPATH /go -ENV PATH $PATH:$GOPATH/bin -ENV CGO_ENABLED 0 +COPY dockerscripts/docker-entrypoint.sh dockerscripts/healthcheck.sh /usr/bin/ +COPY minio /usr/bin/ + ENV MINIO_UPDATE off ENV MINIO_ACCESS_KEY_FILE=access_key \ MINIO_SECRET_KEY_FILE=secret_key -WORKDIR /go/src/github.com/minio/ - -COPY dockerscripts/docker-entrypoint.sh dockerscripts/healthcheck.sh /usr/bin/ - -COPY . /go/src/github.com/minio/minio - -RUN \ +RUN \ apk add --no-cache ca-certificates 'curl>7.61.0' && \ - apk add --no-cache --virtual .build-deps git && \ echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \ - cd /go/src/github.com/minio/minio && \ - go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)" && \ - rm -rf /go/pkg /go/src /usr/local/go && apk del .build-deps + chmod +x /usr/bin/minio && \ + chmod +x /usr/bin/docker-entrypoint.sh && \ + chmod +x /usr/bin/healthcheck.sh EXPOSE 9000 diff --git a/Makefile b/Makefile index 48d31d87c..eb7a73cc1 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,9 @@ build: checks @echo "Building minio binary to './minio'" @CGO_ENABLED=0 go build -tags kqueue --ldflags $(BUILD_LDFLAGS) -o $(PWD)/minio +docker: build + @docker build -t $(TAG) . -f Dockerfile.dev + pkg-add: @echo "Adding new package $(PKG)" @${GOPATH}/bin/govendor add $(PKG)