Commit 0d69b8c4 authored by Eric's avatar Eric

[update] add Dockerfile

parent 7487a937
FROM golang:1.12-alpine as stage-build
WORKDIR /go/src/coco
LABEL stage=stage-build
WORKDIR /go/src/cocogo
RUN apk update && apk add git
RUN export https_proxy=http://192.168.1.9:1087
ARG https_proxy
ARG http_proxy
ENV https_proxy=$https_proxy
ENV http_proxy=$http_proxy
RUN go get -u github.com/golang/dep/cmd/dep
COPY . .
RUN cd cmd && go build coco.go
RUN dep ensure -vendor-only && cd cmd && go build coco.go
FROM alpine
WORKDIR /opt/coco/
COPY --from=stage-build /go/src/coco/cmd/ /opt/coco/
CMD ['/opt/coco/coco']
COPY --from=stage-build /go/src/cocogo/cmd/coco .
COPY --from=stage-build /go/src/cocogo/cmd/locale .
RUN echo > config.yml
EXPOSE 2222
CMD ["./coco"]
......@@ -33,6 +33,11 @@ darwin:
GOOS=darwin GOARCH=amd64 go build -o $(BASEPATH)/$(SOFTWARENAME)-darwin-amd64 $(COCOSRCFILE)
tar czvf $(BASEPATH)/../build/$(SOFTWARENAME)-darwin-amd64.tar.gz $(SOFTWARENAME)-darwin-amd64 locale/ config_example.yml
.PHONY: docker
docker:
@echo "build docker images"
docker build -t cocogo --build-arg http_proxy=$(http_proxy) --build-arg https_proxy=$(https_proxy) $(BASEPATH)/../
.PHONY: clean
clean:
-rm -rf $(BASEPATH)/../build
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment