about summary refs log tree commit diff
path: root/tools/govanity/Dockerfile
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-05-29 09:25:11 -0700
committerFranck Cuny <franck@fcuny.net>2022-05-29 09:25:11 -0700
commitf3a1d10b2c5df68835f86082cfb722ae679190ff (patch)
treeab29190a9e513380ff55b297c4ee58be41a70d12 /tools/govanity/Dockerfile
parentfix(cgit): write the test correctly (diff)
parentremove unused Makefile (diff)
downloadworld-f3a1d10b2c5df68835f86082cfb722ae679190ff.tar.gz
Merge remote-tracking branch 'govanity/main'
Change-Id: I4fd7c748648415db1fa9baaa048ba51e186ec268
Diffstat (limited to 'tools/govanity/Dockerfile')
-rw-r--r--tools/govanity/Dockerfile30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/govanity/Dockerfile b/tools/govanity/Dockerfile
new file mode 100644
index 0000000..20df29f
--- /dev/null
+++ b/tools/govanity/Dockerfile
@@ -0,0 +1,30 @@
+FROM golang:1.16 AS builder
+
+ENV USER=app
+RUN adduser \
+    --disabled-password \
+    --gecos "" \
+    --home "/src" \
+    --shell "/sbin/nologin" \
+    --uid "10001" \
+    "${USER}"
+
+WORKDIR /src
+
+ADD go.mod /src
+ADD go.sum /src
+RUN go mod download
+
+ADD . /src
+
+RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -a -installsuffix cgo -ldflags '-extldflags "-static"' -o app .
+
+FROM scratch
+COPY --from=builder /src/app /vanity
+COPY --from=builder /src/vanity.yaml /vanity.yaml
+COPY --from=builder /etc/passwd /etc/passwd
+COPY --from=builder /etc/group /etc/group
+
+USER app:app
+
+ENTRYPOINT ["/vanity"]