2017-12-12 12:41:01 +01:00
|
|
|
FROM golang:alpine AS build-env
|
2017-12-29 23:12:17 +01:00
|
|
|
LABEL maintainer "Jimmy Zelinskie <jimmyzelinskie+git@gmail.com>"
|
2016-09-06 00:18:29 +02:00
|
|
|
|
2016-09-21 21:26:21 +02:00
|
|
|
# Install OS-level dependencies.
|
2018-09-24 20:04:12 +02:00
|
|
|
RUN apk add --no-cache curl git
|
2016-09-06 00:18:29 +02:00
|
|
|
|
2016-09-21 21:26:21 +02:00
|
|
|
# Copy our source code into the container.
|
2016-09-06 00:18:29 +02:00
|
|
|
WORKDIR /go/src/github.com/chihaya/chihaya
|
2017-12-12 12:41:01 +01:00
|
|
|
COPY . /go/src/github.com/chihaya/chihaya
|
2016-09-21 21:26:21 +02:00
|
|
|
|
|
|
|
# Install our golang dependencies and compile our binary.
|
2017-12-29 23:12:17 +01:00
|
|
|
RUN go get -u github.com/golang/dep/...
|
|
|
|
RUN dep ensure
|
|
|
|
RUN CGO_ENABLED=0 go install github.com/chihaya/chihaya/cmd/...
|
2016-09-06 00:18:29 +02:00
|
|
|
|
2017-12-20 12:51:11 +01:00
|
|
|
FROM alpine:latest
|
2018-09-24 20:04:12 +02:00
|
|
|
RUN apk add --no-cache ca-certificates
|
2017-12-12 12:41:01 +01:00
|
|
|
COPY --from=build-env /go/bin/chihaya /chihaya
|
2017-12-20 12:51:11 +01:00
|
|
|
|
|
|
|
RUN adduser -D chihaya
|
2016-10-22 05:00:20 +02:00
|
|
|
|
2016-09-21 21:26:21 +02:00
|
|
|
# Expose a docker interface to our binary.
|
2018-02-13 10:07:01 +01:00
|
|
|
EXPOSE 6880 6969
|
2017-12-12 12:41:01 +01:00
|
|
|
|
|
|
|
# Drop root privileges
|
|
|
|
USER chihaya
|
|
|
|
|
|
|
|
ENTRYPOINT ["/chihaya"]
|