Add Dockerfile

This commit is contained in:
IamTheFij 2018-08-03 11:35:49 -07:00
parent 3c22782848
commit a4dad986cc
2 changed files with 26 additions and 0 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM golang:1.10 AS builder
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/app/
COPY ./Gopkg.* /go/src/app/
RUN dep ensure --vendor-only
COPY ./main.go /go/src/app/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix nocgo -o dsched .
FROM alpine:latest
WORKDIR /root/
COPY --from=builder /go/src/app/dsched .
CMD [ "./dsched" ]

View File

@ -1,3 +1,5 @@
DOCKER_TAG ?= dsched-dev
.PHONY: default .PHONY: default
default: build default: build
@ -32,3 +34,11 @@ clean-vendor:
.PHONY: dep-update .PHONY: dep-update
dep-update: dep-update:
dep ensure -update dep ensure -update
.PHONY: docker-build
docker-build:
docker build -t $(DOCKER_TAG) .
.PHONY: docker-run
docker-run:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock --name $(DOCKER_TAG)-run $(DOCKER_TAG)