1
0
Fork 0
text-server/Dockerfile

33 lines
574 B
Docker
Raw Permalink Normal View History

2018-09-17 12:02:48 +08:00
FROM golang:1.10-alpine as build
2018-01-11 17:13:31 +08:00
2018-09-17 12:00:54 +08:00
# args
2018-09-17 12:47:27 +08:00
ARG version="1.0.1"
2018-09-17 12:02:03 +08:00
ARG repo="github.com/productionwentdown/text-server"
2018-09-17 12:00:54 +08:00
# source
2018-09-17 12:02:03 +08:00
WORKDIR $GOPATH/src/${repo}
2018-01-11 17:13:31 +08:00
COPY . .
2018-09-17 12:00:54 +08:00
# build
2018-01-11 17:13:31 +08:00
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
2018-09-17 12:00:54 +08:00
RUN go build -ldflags "-s -w" -o /text-server
2018-01-11 17:13:31 +08:00
FROM scratch
2018-09-17 12:05:15 +08:00
ARG version
2018-09-17 12:00:54 +08:00
# labels
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/text-server"
LABEL org.label-schema.version=${version}
LABEL org.label-schema.schema-version="1.0"
# copy binary
2018-09-17 12:02:48 +08:00
COPY --from=build /text-server /text-server
2018-09-17 12:00:54 +08:00
2018-01-11 17:13:31 +08:00
EXPOSE 8080
ENTRYPOINT ["/text-server"]