tracker/Dockerfile

29 lines
747 B
Docker
Raw Normal View History

FROM golang:alpine AS build-env
LABEL maintainer "Jimmy Zelinskie <jimmyzelinskie@gmail.com>"
2016-09-06 00:18:29 +02:00
2016-09-21 21:26:21 +02:00
# Install OS-level dependencies.
RUN apk update && \
apk add curl git && \
curl https://glide.sh/get | sh
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
COPY . /go/src/github.com/chihaya/chihaya
2016-09-21 21:26:21 +02:00
# Install our golang dependencies and compile our binary.
2016-09-06 00:18:29 +02:00
RUN glide install
RUN CGO_ENABLED=0 GOOS=linux go install github.com/chihaya/chihaya/cmd/chihaya
RUN adduser -D chihaya
2016-09-06 00:18:29 +02:00
FROM scratch
COPY --from=build-env /go/bin/chihaya /chihaya
COPY --from=build-env /etc/passwd /etc/passwd
2016-09-21 21:26:21 +02:00
# Expose a docker interface to our binary.
2016-09-06 00:18:29 +02:00
EXPOSE 6880 6881
# Drop root privileges
USER chihaya
ENTRYPOINT ["/chihaya"]