forked from glauth/glauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-standalone
61 lines (46 loc) · 1.83 KB
/
Dockerfile-standalone
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#################
# Build Step
#################
FROM golang:alpine as build
LABEL maintainers="Ben Yanke <[email protected]>, Jörn Friedrich Dreyer <[email protected]>, Chris F Ravenscroft <[email protected]>"
# Setup work env
RUN mkdir /app /tmp/gocode
ADD . /app/
WORKDIR /app
# Required envs for GO
ENV GOPATH=/tmp/gocode
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
# Only needed for alpine builds // also: busybox
RUN apk add --no-cache git make busybox-static dumb-init
# Install deps
RUN go get -d -v ./...
# Build and copy final result -- wrong file BTW
RUN uname -a
RUN if [ $(uname -m) == x86_64 ]; then make linux64 && cp ./bin/glauth64 /app/glauth; fi
RUN if [ $(uname -m) == aarch64 ]; then make linuxarm64 && cp ./bin/glauth-arm64 /app/glauth; fi
RUN if [ $(uname -m) == armv7l ]; then make linuxarm32 && cp ./bin/glauth-arm32 /app/glauth; fi
# Check glauth works
RUN /app/glauth --version
#################
# Run Step
#################
FROM gcr.io/distroless/base-debian10 as run
LABEL maintainers="Ben Yanke <[email protected]>, Jörn Friedrich Dreyer <[email protected]>, Chris F Ravenscroft <[email protected]>"
# Copy binary from build container
COPY --from=build /app/glauth /app/glauth
# Copy docker specific scripts from build container
COPY --from=build /app/scripts/docker/start-standalone.sh /app/docker/
COPY --from=build /app/scripts/docker/default-config-standalone.cfg /app/docker/
# Just what we need
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
COPY --from=build /bin/busybox.static /bin/sh
COPY --from=build /bin/busybox.static /bin/ln
COPY --from=build /bin/busybox.static /bin/rm
RUN ln /bin/sh /usr/bin/cp && ln /bin/sh /usr/bin/mkdir && rm /bin/ln /bin/rm
# Install init
# Expose web and LDAP ports
EXPOSE 389 636 5555
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/bin/sh", "/app/docker/start-standalone.sh"]