forked from micromdm/micromdm
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
32 lines (21 loc) · 881 Bytes
/
Dockerfile
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
FROM golang:1.17 as builder
WORKDIR /go/src/github.com/micromdm/micromdm/
ARG TARGETARCH
ARG TARGETOS
ENV CGO_ENABLED=0 \
GOARCH=$TARGETARCH \
GOOS=$TARGETOS
COPY . .
RUN make deps
RUN make
FROM alpine:latest
RUN apk --update add ca-certificates git
RUN apk add openssl
RUN mkdir repo
RUN mkdir /data; chmod 777 /data
COPY --from=builder /go/src/github.com/micromdm/micromdm/build/linux/micromdm /usr/bin/
COPY --from=builder /go/src/github.com/micromdm/micromdm/build/linux/mdmctl /usr/bin/
RUN DNSNAME=me.home.local; (cat /etc/ssl/openssl.cnf ; printf "\n[SAN]\nsubjectAltName=DNS:$DNSNAME\n") | openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -sha256 -keyout server.key -out server.crt -subj "/CN=$DNSNAME" -reqexts SAN -extensions SAN -config /dev/stdin
RUN sh -c 'echo "127.0.0.1 me.home.local" >> /etc/hosts'
EXPOSE 8080 8443
CMD ["micromdm", "serve"]