Add Dockerfile.

master
Robert Jacob 4 years ago
parent ad9423da28
commit b21e9cc54f
  1. 1
      .dockerignore
  2. 32
      Dockerfile

@ -0,0 +1 @@
ldapmin

@ -0,0 +1,32 @@
FROM golang:1 AS builder
RUN apt-get update && apt-get install -y upx
RUN go get -u github.com/gobuffalo/packr/packr
WORKDIR /build
ENV LD_FLAGS="-w"
ENV CGO_ENABLED=0
COPY go.mod go.sum /build/
RUN go mod download
RUN go mod verify
COPY . /build/
RUN echo "-- TEST" \
&& go test ./... \
&& echo "-- BUILD" \
&& packr install -tags netgo -ldflags "${LD_FLAGS}" . \
&& echo "-- PACK" \
&& upx -9 /go/bin/ldapmin
FROM busybox
LABEL maintainer="Robert Jacob <xperimental@solidproject.de>"
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /go/bin/ldapmin /bin/ldapmin
USER nobody
EXPOSE 8080
ENTRYPOINT ["/bin/ldapmin"]
Loading…
Cancel
Save