serverless / github-action

:zap::octocat: A Github Action for deploying with the Serverless Framework
Apache License 2.0
663 stars 174 forks source link

Deploy a serverless project that uses the serverless-python-requirements plugin #15

Closed raven-rwho closed 5 years ago

raven-rwho commented 5 years ago

Hi,

as stated in the title I do not manage to build an action that allows the deployment of an Python based serverless project that uses the serverless-python-requirements plugin.

The steps are looking like this `name: Deploy master branch on: pull_request:

jobs: deploy: name: deploy runs-on: ubuntu-latest steps:

And the corresponding Dockerfile is:

`FROM nikolaik/python-nodejs:python3.7-nodejs10

LABEL version="1.0.0" LABEL repository="https://github.com/serverless/github-action" LABEL homepage="https://github.com/serverless/github-action" LABEL maintainer="Serverless, Inc. hello@serverless.com (https://serverless.com)"

LABEL "com.github.actions.name"="Serverless" LABEL "com.github.actions.description"="Wraps the Serverless Frameork to enable common Serverless commands." LABEL "com.github.actions.icon"="zap" LABEL "com.github.actions.color"="red"

RUN npm i -g serverless@1.54.0 ENTRYPOINT ["serverless"] `

This ends up in an error in the plugin install step:

`serverless serverless-python-requirements install Error --------------------------------------------------

Error: Cannot find module 'fs-extra' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (/github/workspace/node_modules/serverless-python-requirements/index.js:5:13) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at plugins.forEach.plugin (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:108:18) at Array.forEach () at PluginManager.loadPlugins (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:103:13) at PluginManager.loadServicePlugins (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:148:10) at PluginManager.loadAllPlugins (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:97:10) at pluginManager.loadConfigFile.then.then (/usr/lib/node_modules/serverless/lib/Serverless.js:78:35) at tryCatcher (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)`

I've tried already to move the installation to the Dockerfile but ended up in other errors as well. Did someone managed to solve this?

Thanks a lot!

tdi commented 5 years ago

This is related to #13. I planned to do a Pull request to add plugin install support but if you are up to it then feel free. :)

tdi commented 5 years ago

How I was solving this before was exactly like you did. By using earlier steps but this is inefficient because if builds the image every time. For me it worked however.

raven-rwho commented 5 years ago

I have figured it out and it was just my mistake (I've pushed the node_modules folder to the repo... ) - closing the issue

raven-rwho commented 5 years ago

How I was solving this before was exactly like you did. By using earlier steps but this is inefficient because if builds the image every time. For me it worked however.

Plugin support sounds cool let me know if I can help