Skip to content

Instantly share code, notes, and snippets.

@sandalsoft
Forked from clareliguori/lambda2img.Dockerfile
Created March 23, 2019 14:53
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 sandalsoft/154e463bc763f212ed33dc69ace881f0 to your computer and use it in GitHub Desktop.
Save sandalsoft/154e463bc763f212ed33dc69ace881f0 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