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
```
master
Harshavardhana 6 years ago committed by kannappanr
parent 8cf7b88cc5
commit ec2295c3dc
  1. 21
      Dockerfile.dev
  2. 3
      Makefile

@ -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/
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 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

@ -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)

Loading…
Cancel
Save