Skip to content

Commit

Permalink
Add git lfs to lambda layer
Browse files Browse the repository at this point in the history
Resolves lambci#22

This adds the appropriate `git-lfs` RPM repo and validates its signature, then installs it with the `yum install` command. We have to manually move the `git-lfs` binary (which is [the only file required for git-lfs](https://github.com/git-lfs/git-lfs/wiki/Installation#other)) into the `/opt/bin/` folder of the output so that it will be available in the `$PATH` in the lambda layer.

This manual handling of the RPM repo is done because the [standard git-lfs install script](https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh) has hardcoded `/etc/` all over the place, whereas we need it to respect the `/lambda/` root.
  • Loading branch information
freakingawesome authored Mar 4, 2021
1 parent 3b4d359 commit 015db73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lambda2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
rm layer.zip

docker run --rm -v "$PWD":/tmp/layer lambci/yumda:2 bash -c "
yum install -y git-${GIT_VERSION} && \
curl -sSf 'https://packagecloud.io/install/repositories/github/git-lfs/config_file.repo?os=amzn&dist=2&source=script' > /lambda/etc/yum.repos.d/github_git-lfs.repo && \
yum -q makecache -y --disablerepo='*' --enablerepo='github_git-lfs' --enablerepo='github_git-lfs-source' && \
yum install -y git-${GIT_VERSION} git-lfs && \
mv /lambda/usr/bin/git-lfs /lambda/opt/bin/git-lfs && \
cd /lambda/opt && \
zip -yr /tmp/layer/layer.zip .
"

0 comments on commit 015db73

Please sign in to comment.