64d471d13a
With Go Modules, the current Dockerfile ignores the code that was COPY'd from the Docker context (and thus always building/installing what was on GitHub).
26 lines
648 B
Docker
26 lines
648 B
Docker
FROM golang:alpine AS build-env
|
|
LABEL maintainer "Jimmy Zelinskie <jimmyzelinskie+git@gmail.com>"
|
|
|
|
# Install OS-level dependencies.
|
|
RUN apk add --no-cache curl git
|
|
|
|
# Copy our source code into the container.
|
|
WORKDIR /go/src/github.com/chihaya/chihaya
|
|
COPY . /go/src/github.com/chihaya/chihaya
|
|
|
|
# Install our golang dependencies and compile our binary.
|
|
RUN CGO_ENABLED=0 go install ./cmd/chihaya
|
|
|
|
FROM alpine:latest
|
|
RUN apk add --no-cache ca-certificates
|
|
COPY --from=build-env /go/bin/chihaya /chihaya
|
|
|
|
RUN adduser -D chihaya
|
|
|
|
# Expose a docker interface to our binary.
|
|
EXPOSE 6880 6969
|
|
|
|
# Drop root privileges
|
|
USER chihaya
|
|
|
|
ENTRYPOINT ["/chihaya"]
|