Closed acinader closed 6 years ago
One option, which I've been using for parse-server-compose, is to install dependencies into the same directory as the cloud code and mount that in docker:
cloud
├── main.js
├── node_modules
│ └── ...
└── package.json
docker run -v /path/to/cloud:/parse-server/cloud ...
If any dependencies use native code and need to be built in the container you'll need to run this first:
docker run --rm -it -v $(pwd):/home/node --workdir /home/node node:boron npm install
@stephentuso so I worked out a super hacky workaround that is close to yours:
run npm install -S xxx
in the ./cloud dir so that there is a package.json in that dir.
make sure to add parse-server as a dependency.
I'm using aws beanstalk (for now, hopefully switching to kubernetes as soon as I get the time). I overwrite the entry point in my Dockerrun.aws.json to:
"entryPoint": ["sh", "-c" , "/usr/local/bin/npm install /parse-server/cloud ; /usr/local/bin/node /parse-server/bin/parse-server /parse-server/config/configuration.json"],
I'll study what you've got there and see if its an improvement for me.
my hack really sucks because I have to cd into cloud, run install, cd out and then deploy.
i'm wondering if I can somehow adjust an npm-run-script, preinstall or postinstall to check if there is a a ./cloud/package.json and install that....
the ./cloud is hardcoded in the dockerfile
I'm also looking at @yongjhih to see how he does it in https://github.com/yongjhih/docker-parse-server
Gotcha yeah that looks about the same, I was only thinking about running locally. Could potentially be easier to just write a new Dockerfile
And I spoke too soon. My packages are getting installed. And my cloud code is being processed by parse (if I put a debug log in my cloud code files it ends up in the logs), but when I call my cloud functions parse doesn't fine them with `error: Invalid function: "sendCode" code=141, message=Invalid function: "sendCode"
enough debugging on this for today :(
I'm going to close this as unresolved for now.
Just write a regular express app, install parse-server as a dependency and mount it to the express app
We are running into this issue as well with Docker.. Whats the proper procedure for getting cloud code to work in a container? I see some solutions but has this never been tested till now?
I've been trying to use the parse-server docker. I've run into a problem trying to use cloud code and I'm curious if anyone has a solution.
If my cloud code requires npm packages (would think this is almost always the case), is there a pattern or solution of how to npm install?