Add Dockerfile
This commit is contained in:
parent
3c22782848
commit
a4dad986cc
16
Dockerfile
Normal file
16
Dockerfile
Normal 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" ]
|
10
Makefile
10
Makefile
@ -1,3 +1,5 @@
|
||||
DOCKER_TAG ?= dsched-dev
|
||||
|
||||
.PHONY: default
|
||||
default: build
|
||||
|
||||
@ -32,3 +34,11 @@ clean-vendor:
|
||||
.PHONY: dep-update
|
||||
dep-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)
|
||||
|
Loading…
Reference in New Issue
Block a user