2019-03-20 21:29:42 -07:00
|
|
|
ARG src_dir="/gortr"
|
2018-08-07 11:09:50 -07:00
|
|
|
|
2018-09-22 17:24:11 +03:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
ARG src_dir
|
2019-07-31 15:14:36 -07:00
|
|
|
ARG LDFLAGS=""
|
2018-08-07 11:09:50 -07:00
|
|
|
|
2018-09-22 17:24:11 +03:00
|
|
|
RUN apk --update --no-cache add git && \
|
|
|
|
mkdir -p ${src_dir}
|
|
|
|
|
|
|
|
WORKDIR ${src_dir}
|
|
|
|
COPY . .
|
|
|
|
|
2019-07-31 15:14:36 -07:00
|
|
|
RUN go build -ldflags "${LDFLAGS}" cmd/gortr/gortr.go
|
2018-09-22 17:24:11 +03:00
|
|
|
|
2019-04-11 14:25:14 -07:00
|
|
|
FROM alpine:latest as keygen
|
|
|
|
|
|
|
|
RUN apk --update --no-cache add openssl
|
|
|
|
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
|
|
|
|
|
2018-09-22 17:24:11 +03:00
|
|
|
FROM alpine:latest
|
|
|
|
ARG src_dir
|
|
|
|
|
|
|
|
RUN apk --update --no-cache add ca-certificates && \
|
|
|
|
adduser -S -D -H -h / rtr
|
|
|
|
USER rtr
|
|
|
|
|
|
|
|
COPY --from=builder ${src_dir}/gortr ${src_dir}/cmd/gortr/cf.pub /
|
2019-04-11 14:25:14 -07:00
|
|
|
COPY --from=keygen /private.pem /private.pem
|
2018-08-07 11:09:50 -07:00
|
|
|
ENTRYPOINT ["./gortr"]
|