Last active
January 19, 2021 18:47
-
-
Save sofianhamiti/2e5287cbba372f7e70441814c7c44f60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM public.ecr.aws/lambda/provided | |
| ENV R_VERSION=4.0.3 | |
| ENV PATH="${PATH}:/opt/R/${R_VERSION}/bin/" | |
| # install R | |
| RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ | |
| && yum -y install https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm \ | |
| openssl-devel \ | |
| libxml2-devel \ | |
| unzip \ | |
| && yum clean all \ | |
| && rm -rf /var/cache/yum/* | |
| # install AWS CLI | |
| RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ | |
| && unzip awscliv2.zip \ | |
| && ./aws/install \ | |
| && rm -f awscliv2.zip | |
| # install R packages | |
| RUN Rscript -e "install.packages(c('httr', 'logger', 'glue', 'jsonslite', 'randomForest'), repos = 'https://cloud.r-project.org/')" | |
| # Copy R runtime and inference code | |
| COPY runtime.R predict.R ${LAMBDA_TASK_ROOT}/ | |
| RUN chmod 755 -R ${LAMBDA_TASK_ROOT}/ | |
| COPY bootstrap ${LAMBDA_RUNTIME_DIR}/ | |
| RUN chmod 755 ${LAMBDA_RUNTIME_DIR}/bootstrap | |
| RUN rm -rf /tmp/* | |
| CMD [ "predict.handler" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment