diff --git a/assets/custom-email-sender/Dockerfile b/assets/custom-email-sender/Dockerfile new file mode 100644 index 0000000..5c24748 --- /dev/null +++ b/assets/custom-email-sender/Dockerfile @@ -0,0 +1,30 @@ +# --------------------------------------------------------------------- base --- + +FROM golang:1.19 as base + +ARG APP_VERSION=latest + +ENV GOOS=linux +ENV GOARCH=amd64 +ENV CGO_ENABLED=0 + +RUN mkdir -p /opt/app +WORKDIR /opt/app + +RUN git clone https://github.com/cruxstack/cognito-custom-message-sender-go.git . +RUN if [ "$APP_VERSION" != "latest" ] ; then git checkout $APP_VERSION ; fi +RUN go mod download +RUN go build -o bootstrap + +RUN echo "$SERVICE_OPA_POLICY_ENCODED" | base64 -d > /opt/app/policy.rego + +# ------------------------------------------------------------------ package --- + +FROM alpine:latest as package + +COPY --from=base /opt/app/bootstrap /opt/app/dist/bootstrap +COPY --from=base /opt/app/policy.rego /opt/app/dist/policy.rego + +RUN apk add zip \ + && cd /opt/app/dist \ + && zip -r /tmp/package.zip .