-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
30 lines (20 loc) · 864 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
# syntax=docker/dockerfile:1.3-labs
FROM golang:1.18 AS build
WORKDIR /app
COPY . ./
RUN find .
# CGO_ENABLED=0 ~ https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host
RUN mkdir -p /app/out \
&& cd /app/cmd \
&& CGO_ENABLED=0 go build -o ../out/server server/server.go \
&& CGO_ENABLED=0 go build -o ../out/encrypt encrypt/encrypt.go \
&& CGO_ENABLED=0 go build -o ../out/decrypt decrypt/decrypt.go
FROM alpine
WORKDIR /
COPY --from=build /app/out/server /usr/local/bin/tang-encryption-provider
COPY --from=build /app/out/encrypt /usr/local/bin/encrypt
COPY --from=build /app/out/decrypt /usr/local/bin/decrypt
RUN addgroup nonroot && adduser -G nonroot -D nonroot
RUN apk update && apk add bind-tools
# USER nonroot:nonroot
# ENTRYPOINT ["/usr/local/bin/tang-encryption-provider"]