From 46eab30ad0afddd6ef5bdc7d5e45a7564f39635e Mon Sep 17 00:00:00 2001 From: Sebastian Plattner Date: Wed, 27 Sep 2023 21:06:34 +0200 Subject: [PATCH] (feat) Multistage Docker build --- build/Dockerfile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index c885353..721008e 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 +FROM golang:1.21 AS build-env WORKDIR /go/src/app COPY ./ . @@ -8,4 +8,24 @@ RUN ls -al RUN go get -d -v ./... RUN go install -v ./... -ENTRYPOINT [ "/go/bin/ucrt" ] + +FROM alpine:3 + +LABEL maintainer "Sebastian Plattner" +LABEL org.opencontainers.image.title "Unfolded Cirrle Remote Two Integraton Driber" +LABEL org.opencontainers.image.description "Golang based integration driver for a Unfolded Circle Remote Two" +LABEL org.opencontainers.image.authors "Sebastian Plattner" +LABEL org.opencontainers.image.source https://github.com/splattner/goucrt +LABEL org.opencontainers.image.licenses MPL-2.0 + +RUN apk --no-cache add libc6-compat + +COPY --from=build-env /go/bin/ucrt /app/ + +WORKDIR /app + +RUN adduser -D nonroot +USER nonroot + +ENTRYPOINT [ "/app/ucrt" ] +CMD [ "help" ]