I have a serverless python app that uses the plugin "serverless-python-requirements". In my bitbucket-pipelines.yml I have the following,
<span>image</span><span>: </span><span>node:15.10.0-alpine<br></span><br><span>pipelines</span><span>:</span> <br><span> branches</span><span>:<br></span><span> master</span><span>:<br></span><span> - </span><span>step</span><span>:<br></span><span> name</span><span>: </span><span>'Deployment to Staging'<br></span><span> deployment</span><span>: </span><span>staging<br></span><span> script</span><span>:<br></span><span> - </span><span>cd ./project_dir<br></span><span> - </span><span>apk add python3<br></span><span> - </span><span>npm install -g serverless<br></span><span> - </span><span>npm install --save serverless-python-requirements<br></span><span> - </span><span>serverless config credentials --provider aws --key $AWS_DEV_LAMBDA_KEY --secret $AWS_DEV_LAMBDA_SECRET<br></span><span> - </span><span>serverless deploy --stage dev<br></span><span> services</span><span>:<br></span><span> - </span><span>docker</span>
the last step progresses as follows,
<span>Serverless: Generated requirements from /opt/atlassian/pipelines/agent/build/project_dir/requirements.txt in /opt/atlassian/pipelines/agent/build/project_dir/.serverless/requirements.txt...<br></span><span>Serverless: Installing requirements from /root/.cache/serverless-python-requirements/679f0c7a123e5d80212530da94d545f92ad890ecf43e8288e2b6bc243b4e138b_slspyc/requirements.txt ...</span><span><br>Serverless: Docker Image: lambci/lambda:build-python3.6</span><span>Serverless: Using download cache directory /root/.cache/serverless-python-requirements/downloadCacheslspyc</span><span>Serverless: Running docker run --rm -v /root/.cache/serverless-python-requirements/679f0c7a123e5d80212530da94d545f92ad890ecf43e8288e2b6bc243b4e138b_slspyc\:/var/task\:z -v /root/.cache/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z lambci/lambda\:build-python3.6 /bin/sh -c 'chown -R 0\\:0 /var/useDownloadCache && python3.6 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache && chown -R 0\\:0 /var/task && chown -R 0\\:0 /var/useDownloadCache'...</span><span>+ serverless deploy --stage dev<br></span>
until I get the following error:
<span>Error: STDOUT:<br></span><span>STDERR: docker: Error response from daemon: authorization denied by plugin pipelines: -v only supports $BITBUCKET_CLONE_DIR and its subdirectories.</span><span>Error --------------------------------------------------<br></span>
I've tried using the serverless-deploy pipe option too but get the same error.
- pipe: atlassian/serverless-deploy:0.2.2
variables:
AWS_ACCESS_KEY_ID: $AWS_DEV_LAMBDA_KEY
AWS_SECRET_ACCESS_KEY: $AWS_DEV_LAMBDA_SECRET
EXTRA_ARGS: '--stage dev'
I'm hoping this is an easy fix and I've done something silly!
**UPDATE**
I have it working by using the serverless.yml `non-linux` instead of `true` setting
custom:
pythonRequirements:
dockerizePip: non-linux
and the bitbucket-pipelines.yml
image: node:15.10.0-alpine
pipelines:
branches:
master:
- step:
name: 'Deployment to Staging'
deployment: staging
script:
- cd ./project_dir
- apk add python3
- npm install
- npm install -g serverless
- serverless plugin install -n serverless-python-requirements
- serverless config credentials --overwrite --provider aws --key $AWS_DEV_LAMBDA_KEY --secret $AWS_DEV_LAMBDA_SECRET
- serverless deploy --stage dev
however I still don't understand why the deployment using docker didn't work