hugo-aws-lambda-layer
September 14, 2021 ยท View on GitHub
AWS Lambda Layer for Hugo from gohugo.io.
It is intended to be functional in all runtimes. It has been tested in go1.x and python3.8 so far.
Building the Layer
-
Make certain you have the
lambci/lambda:build-go1.xDocker image needed to build the layer.$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE lambci/lambda build-go1.x 051f7de811cf 11 days ago 2.2GB- If you do not have the images, just pull them with a
docker pullcommand.
- If you do not have the images, just pull them with a
-
Confirm the build directory is clean.
$ ls -1 LICENSE README.md build.sh -
Then execute the dockerlambci/lambda:build-go1.ximage to run the build script.docker run --rm -it -vpwd:/tmp/repo --entrypoint /bin/bash lambci/lambda:build-go1.x /tmp/repo/build.shUsing the
golang:1.17.1-alpine3.14image, run the build script (can't uselamci/lambdaanymore due to golang version requirement):docker run --rm -it -v `pwd`:tmp/repo --entrypoint /bin/bash golang:1.17.1-alpine3.14 /tmp/repo/build.sh
Deploy the Layer
Once the layer zip file is created, you can deploy it to your AWS account with the following command:
aws lambda publish-layer-version --layer-name "hugo-VERSION" --description "Hugo VERSION for All Runtimes" --license-info "Apache 2.0" --zip-file "fileb://hugo.zip"