summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..fdc1919
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+ARG GO_VERSION=1.18
+
+FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
+ARG TARGETOS
+ARG TARGETARCH
+
+WORKDIR /build
+COPY . .
+RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static'" && \
+ echo "skunkyart:x:10000:10000:SkunkyArt user:/:/sbin/nologin" > /etc/minimal-passwd && \
+ echo "skunkyart:x:10000:" > /etc/minimal-group
+
+FROM scratch
+
+COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
+COPY --from=build /build/static /static
+COPY --from=build /build/skunkyart /skunkyart
+COPY --from=build /etc/minimal-passwd /etc/passwd
+COPY --from=build /etc/minimal-group /etc/group
+
+USER skunkyart
+
+ENTRYPOINT ["/skunkyart"]