lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins agent install on lambci/lambda:build-python3.7

jambstud opened this issue · comments

Hello,

Would be possible to extend the image : lambci/lambda:build-python3.7 to contain the jenkins/inbound-agent?

This will be help when different lambda build libraries required to run from a container jenkins node .

looks this did the trick to add the jenkins agent into the image;

FROM lambci/lambda:build-python3.7

ARG VERSION=4.9
ARG user=jenkins
ARG group=jenkins
ARG uid=1001
ARG gid=1001
ARG AGENT_WORKDIR=/home/${user}/agent

ec2-user id is 1000

ENV TERRAFORM_VERSION 1.1.3
ENV TERRAGRUNT_VERSION v0.35.16

USER root

create jenkins user/group/home

RUN groupadd ${group}
RUN adduser -ms /bin/bash -u ${uid} -g ${group} ${user}
RUN yum update -y && yum install -y openjdk11 curl bash git perl-Archive-Zip pytest moto==2.0.8 mock freezegun requests_sigv4 zip unzip ansible curl jq awscli

Jenkins node agent.jar

RUN curl --create-dirs -fsSLo /usr/share/jenkins/agent.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar
&& chmod 755 /usr/share/jenkins
&& chmod 644 /usr/share/jenkins/agent.jar
&& ln -sf /usr/share/jenkins/agent.jar /usr/share/jenkins/slave.jar
&& rm -rf /tmp/.apk /tmp/gcc /tmp/gcc-libs.tar /tmp/libz /tmp/libz.tar.xz /var/cache/apk/*

COPY jenkins-agent /usr/local/bin/jenkins-agent
RUN chmod +x /usr/local/bin/jenkins-agent &&
ln -s /usr/local/bin/jenkins-agent /usr/local/bin/jenkins-slave

WORKDIR /home/jenkins
COPY jenkins_nodes.yaml .

Install terraform

RUN curl -o /tmp/terraform.zip -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
&& cd /usr/local/bin
&& unzip /tmp/terraform.zip
&& chmod +x terraform
&& rm /tmp/terraform.zip

Install terragrunt

RUN curl -o /usr/local/bin/terragrunt -fsSL "https://github.com/gruntwork-io/terragrunt/releases/download/${TERRAGRUNT_VERSION}/terragrunt_linux_amd64"
&& chmod +x /usr/local/bin/terragrunt

USER ${user}
RUN mkdir /home/${user}/.jenkins && mkdir -p ${AGENT_WORKDIR}

ENTRYPOINT ["/usr/local/bin/jenkins-agent"]

maybe there are ways