Last active
August 26, 2022 21:54
-
-
Save devilelephant/139402227f596df86cc2f504c8450147 to your computer and use it in GitHub Desktop.
Multipart Dockerfile to download Open Policy Agent into an AWS Lambda
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
# Pull latest static opa executable image | |
FROM openpolicyagent/opa:latest-static AS opa-stage | |
# Start lambda image | |
FROM public.ecr.aws/lambda/java:11 | |
ARG OPA_INSTALL_PATH=${LAMBDA_TASK_ROOT}/opa | |
ARG OPA_EXECUTABLE_PATH=${OPA_INSTALL_PATH}/opa | |
COPY --from=opa-stage /opa ${OPA_INSTALL_PATH}/ | |
RUN chmod +x ${OPA_EXECUTABLE_PATH} | |
# Copy function code and runtime dependencies from Gradle layout | |
COPY build/explode ${LAMBDA_TASK_ROOT} | |
# Tell lambda where the handler lives | |
CMD [ "example.lambda.JavaLambdaHandler" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment