In my nodejs application I use a library that needs python, for this reason I need it installed in my app together with nodejs. How can I do it?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey @a73f776eefc546709cb0576d5f4284,
I’ll recommend checking this docs page :
https://docs.digitalocean.com/products/app-platform/reference/buildpacks/nodejs/
When you give App Platform access to your code, it defaults to using a Dockerfile if one is present in the root of the directory or specified in the app spec. Otherwise, App Platform checks your code to determine what language or framework it uses. If it supports the language or framework, it chooses an appropriate resource type and uses the proper buildpack to build the app and deploy a container.
heroku-buildpack-nodejs is utilized as the buildpack for detecting and building your NodeJS applications.
Use Dockerfile
To add Python to your Node.js app in DigitalOcean App Platform, you can create a custom Dockerfile that includes both Node.js and Python.
Something like this should work:
This Dockerfile installs Python 3 and sets the working directory to “/app”. It then copies the package.json and package-lock.json files to the working directory, installs the dependencies with
npm install
, and copies the rest of the application code to the working directory. Finally, it starts the application withnpm start
.You’ll need to add the Dockerfile to your GitHub repo and redeploy the app.
Hope that helps!
This comment has been deleted