I have tried to build my Flask app from my Github repository using the App Platform UI.
I have managed to build the app, as indicated by the build logs, but I am unable to deploy the app, and the deployment log kept on throwing this particular error:
I have tried changing the dependency from opencv-python to opencv-python-headless, but to no avail, and after some simple search online, I found that OpenCV is not supported by heroku-python-buildpack, which is the default buildpack used by App Platform to build the app.
I am wondering what are the steps which I can take, or files which I have to add to my Github repository, in order for App Platform to be able to compile OpenCV for use with my Flask app.
Any form of help will be appreciated.
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!
Great question, I think this would be a good candidate for using Dockerfile based builds.
I hacked together a sample flask app that uses opencv. Disclaimer I don’t have any Python/Flask experience so this might not be best practice.
A Dockerfile based build will automatically be detected if the Dockerfile exists in the root of the project. My dockerfile looks like:
FROM ubuntu
RUN apt-get update -y --fix-missing --allow-releaseinfo-change
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3.6 python3-pip python3-pip python-dev build-essential libgl1-mesa-glx libsm6 libxext6 libglib2.0-0
RUN mkdir /app
WORKDIR /app
COPY . /app/
RUN pip3 install --upgrade pip
RUN pip3 install flask
RUN pip3 install -r requirements.txt
CMD ["python3", "app.py"]
and my DO app spec looks like:
name: flask-opencv-streaming
region: nyc
services:
- dockerfile_path: Dockerfile
github:
branch: master
deploy_on_push: true
repo: jonfriesen/flask-opencv-streaming
http_port: 8080
instance_count: 1
instance_size_slug: basic-xs
name: flask-opencv-streaming
routes:
- path: /
source_dir: /
I have the same issue. I thought app platform was supposed to be an easy deployment :(
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.