-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
45 lines (37 loc) · 1.42 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
FROM golang:1.17-alpine As builder
MAINTAINER Fullstory Engineering
# create non-privileged group and user
RUN addgroup -S emulators && adduser -S emulators -G emulators
RUN mkdir -p /data
ENV CGO_ENABLED=0
ENV GO111MODULE=on
WORKDIR /tmp/fullstorydev/bigtable
COPY VERSION bigtable /tmp/fullstorydev/bigtable/
RUN go build -o /cbtemulator \
-ldflags "-w -extldflags \"-static\" -X \"main.version=$(cat VERSION)\"" \
./cmd/cbtemulator
WORKDIR /tmp/fullstorydev/storage
COPY VERSION storage /tmp/fullstorydev/storage/
RUN go build -o /gcsemulator \
-ldflags "-w -extldflags \"-static\" -X \"main.version=$(cat VERSION)\"" \
./cmd/gcsemulator
### Deploy
FROM scratch AS cbtemulator
WORKDIR /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /cbtemulator /bin/cbtemulator
COPY --from=builder --chown=emulators /data /data
EXPOSE 9000
USER emulators
ENTRYPOINT ["/bin/cbtemulator", "-port", "9000", "-host", "0.0.0.0", "-dir", "/data"]
### Deploy
FROM scratch AS gcsemulator
WORKDIR /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /gcsemulator /bin/gcsemulator
COPY --from=builder --chown=emulators /data /data
EXPOSE 9000
USER emulators
ENTRYPOINT ["/bin/gcsemulator", "-port", "9000", "-host", "0.0.0.0", "-dir", "/data"]