-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
49 lines (30 loc) · 1.19 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# build stage
FROM golang:1.12-alpine@sha256:1121c345b1489bb5e8a9a65b612c8fed53c175ce72ac1c76cf12bbfc35211310 as builder
ENV GO111MODULE=on
RUN mkdir /user && \
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
echo 'nobody:x:65534:' > /user/group
RUN apk update && apk add --no-cache git \
gcc \
musl-dev \
linux-headers \
tzdata \
ca-certificates && update-ca-certificates 2>/dev/null || true
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN cp config/config.yaml.example config/config.yaml
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static"' -o tomox-sdk
FROM ubuntu AS final
LABEL author="Hai Dam <[email protected]>"
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /user/group /user/passwd /etc/
COPY --from=builder /app/tomox-sdk /tomox/
WORKDIR /tomox
USER nobody:nobody
RUN mkdir logs
ENTRYPOINT ["/tomox/tomox-sdk"]
EXPOSE 8080