Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an "R only" layer for mixing R with other runtimes #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions awspack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BUILD_DIR=${BASE_DIR}/build/
rm -rf ${BUILD_DIR}

mkdir -p ${BUILD_DIR}/layer/
docker run -v ${BUILD_DIR}/layer/:/var/awspack -v ${BASE_DIR}/entrypoint.sh:/entrypoint.sh \
docker run --user $(id -u) -v ${BUILD_DIR}/layer/:/var/awspack -v ${BASE_DIR}/entrypoint.sh:/entrypoint.sh \
lambda-r:build-${VERSION} /entrypoint.sh
sudo chown -R $(whoami):$(whoami) ${BUILD_DIR}/layer/

chmod -R 755 ${BUILD_DIR}/layer/
8 changes: 5 additions & 3 deletions r/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ R_DIR=/opt/R/

rm -rf ${BUILD_DIR}

mkdir -p ${BUILD_DIR}/bin/
docker run -v ${BUILD_DIR}/bin/:/var/r lambda-r:build-${VERSION}
sudo chown -R $(whoami):$(whoami) ${BUILD_DIR}/bin/
mkdir -p ${BUILD_DIR}/layer/R/
docker run --user $(id -u) -v ${BUILD_DIR}/layer/R:/var/r lambda-r:build-${VERSION}

cd ${BUILD_DIR}/layer/
rm -r R/doc/manual/
2 changes: 1 addition & 1 deletion recommended/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BUILD_DIR=${BASE_DIR}/build/
rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}/layer/R.orig/
cd ${BUILD_DIR}/layer/
cp -r ${BASE_DIR}/../r/build/bin/* R.orig/
cp -r ${BASE_DIR}/../r/build/layer/R/* R.orig/
mkdir -p R/library

recommended=(boot class cluster codetools foreign KernSmooth lattice MASS Matrix mgcv nlme nnet rpart spatial survival)
Expand Down
3 changes: 1 addition & 2 deletions runtime/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR}/layer/R/
cp ${BASE_DIR}/src/* ${BUILD_DIR}/layer/
cd ${BUILD_DIR}/layer/
cp -r ${BASE_DIR}/../r/build/bin/* R/
rm -r R/doc/manual/
cp -r ${BASE_DIR}/../r/build/layer/* .
#remove some libraries to save space
recommended=(boot class cluster codetools foreign KernSmooth lattice MASS Matrix mgcv nlme nnet rpart spatial survival)
for package in "${recommended[@]}"
Expand Down
12 changes: 12 additions & 0 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ Globals:
Layers:
- !Ref RuntimeLayer
Resources:
RLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: !Sub r-${Version}
ContentUri: r/build/layer/
LicenseInfo: MIT
RLayerPermission:
Type: AWS::Lambda::LayerVersionPermission
Properties:
Action: lambda:GetLayerVersion
LayerVersionArn: !Ref RLayer
Principal: "*"
RuntimeLayer:
Type: AWS::Serverless::LayerVersion
Properties:
Expand Down