Skip to content

Instantly share code, notes, and snippets.

@clareliguori
Last active March 4, 2020 04:10
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save clareliguori/65cc21b57f740fb9c37ace0573768f25 to your computer and use it in GitHub Desktop.
Save clareliguori/65cc21b57f740fb9c37ace0573768f25 to your computer and use it in GitHub Desktop.
ARG FUNCTION_RUNTIME
FROM mikesir87/aws-cli as code
ARG FUNCTION_NAME
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
RUN wget -O function.zip `aws lambda get-function --function-name $FUNCTION_NAME --query 'Code.Location' --output text`
RUN mkdir /function
RUN unzip function.zip -d /function
FROM lambci/lambda:$FUNCTION_RUNTIME
COPY --from=code /function /var/task
docker build \
--build-arg AWS_DEFAULT_REGION=us-west-2 \
--build-arg AWS_ACCESS_KEY_ID=AKIAXXXXXXXX \
--build-arg AWS_SECRET_ACCESS_KEY=XXXXXXXX \
--build-arg FUNCTION_NAME=HelloWorld \
--build-arg FUNCTION_RUNTIME=nodejs8.10 \
-t helloworld \
-f lambda2img.Dockerfile .
docker run helloworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment