-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 . |