Serverless-offline in Docker image used as Jenkins agent

Hi all - I’m trying to package up serverless and it’s dependencies in a Docker image and then use that Docker image as a Jenkins agent to execute against. When running locally, the “serverless config credentials…” command executes in the running container just fine. When running in a Jenkins pipeline, I get “Serverless plugin “serverless-offline” not found. Make sure it’s installed and listed in the “plugins” section of your serverless config file.”

Has anyone tried this before? Any advice?

My Dockerfile is

FROM node:8-alpine

RUN apk update &&
apk add curl

RUN npm install -g serverless &&
npm install -g serverless-offline &&
npm install -g yarn &&
yarn add --dev jest

USER node

RUN mkdir -p /home/node/app

WORKDIR /home/node/app

COPY package*.json ./

RUN yarn

COPY . .

My Jenkins stage is:

stage(‘Deploy’) {
agent {
docker {
label ‘master’
image ‘nexus.ascap.com:18443/slscognito
registryUrl ‘https://nexus.ascap.com/
registryCredentialsId ‘Jenkins_docker_pull_nexus’
args ‘-v /var/run/docker.sock:/var/run/docker.sock’
}
}
steps {
withCredentials([[$class: ‘AmazonWebServicesCredentialsBinding’, credentialsId: ‘aws-sandbox-jenkins’]]) {
sh ‘’’
serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY
sls deploy
‘’’
}
}
}