Skip to content

Instantly share code, notes, and snippets.

@devilelephant
Last active August 26, 2022 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devilelephant/139402227f596df86cc2f504c8450147 to your computer and use it in GitHub Desktop.
Save devilelephant/139402227f596df86cc2f504c8450147 to your computer and use it in GitHub Desktop.
Multipart Dockerfile to download Open Policy Agent into an AWS Lambda
# 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