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
```
This commit is contained in:
Harshavardhana 2018-09-25 10:33:25 -07:00 committed by kannappanr
parent 8cf7b88cc5
commit ec2295c3dc
2 changed files with 11 additions and 15 deletions

View File

@ -1,27 +1,20 @@
FROM golang:1.10.1-alpine3.7 FROM alpine:3.7
LABEL maintainer="Minio Inc <dev@minio.io>" LABEL maintainer="Minio Inc <dev@minio.io>"
ENV GOPATH /go COPY dockerscripts/docker-entrypoint.sh dockerscripts/healthcheck.sh /usr/bin/
ENV PATH $PATH:$GOPATH/bin COPY minio /usr/bin/
ENV CGO_ENABLED 0
ENV MINIO_UPDATE off ENV MINIO_UPDATE off
ENV MINIO_ACCESS_KEY_FILE=access_key \ ENV MINIO_ACCESS_KEY_FILE=access_key \
MINIO_SECRET_KEY_FILE=secret_key MINIO_SECRET_KEY_FILE=secret_key
WORKDIR /go/src/github.com/minio/ RUN \
COPY dockerscripts/docker-entrypoint.sh dockerscripts/healthcheck.sh /usr/bin/
COPY . /go/src/github.com/minio/minio
RUN \
apk add --no-cache ca-certificates 'curl>7.61.0' && \ 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 && \ echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf && \
cd /go/src/github.com/minio/minio && \ chmod +x /usr/bin/minio && \
go install -v -ldflags "$(go run buildscripts/gen-ldflags.go)" && \ chmod +x /usr/bin/docker-entrypoint.sh && \
rm -rf /go/pkg /go/src /usr/local/go && apk del .build-deps chmod +x /usr/bin/healthcheck.sh
EXPOSE 9000 EXPOSE 9000

View File

@ -75,6 +75,9 @@ build: checks
@echo "Building minio binary to './minio'" @echo "Building minio binary to './minio'"
@CGO_ENABLED=0 go build -tags kqueue --ldflags $(BUILD_LDFLAGS) -o $(PWD)/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: pkg-add:
@echo "Adding new package $(PKG)" @echo "Adding new package $(PKG)"
@${GOPATH}/bin/govendor add $(PKG) @${GOPATH}/bin/govendor add $(PKG)