forked from heroku/alpinehelloworld
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to import opencv, but an old version
- Loading branch information
Showing
2 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
#Grab the latest alpine image | ||
FROM alpine:latest | ||
FROM heroku/heroku:16 | ||
|
||
# Install python and pip | ||
RUN apk add --no-cache --update python py-pip bash | ||
ADD ./webapp/requirements.txt /tmp/requirements.txt | ||
# Install pip and opencv | ||
RUN apt-get update && apt-get install -y python-pip python-opencv | ||
|
||
# Install dependencies | ||
ADD ./webapp/requirements.txt /tmp/requirements.txt | ||
RUN pip install --no-cache-dir -q -r /tmp/requirements.txt | ||
|
||
# Add our code | ||
ADD ./webapp /opt/webapp/ | ||
WORKDIR /opt/webapp | ||
|
||
# Expose is NOT supported by Heroku | ||
# EXPOSE 5000 | ||
# EXPOSE 5000 | ||
|
||
# Run the image as a non-root user | ||
RUN adduser -D myuser | ||
RUN useradd -m myuser | ||
USER myuser | ||
|
||
# Run the app. CMD is required to run on Heroku | ||
# $PORT is set by Heroku | ||
CMD gunicorn --bind 0.0.0.0:$PORT wsgi | ||
|
||
# $PORT is set by Heroku | ||
CMD gunicorn --bind 0.0.0.0:$PORT wsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import os | ||
import cv2 | ||
|
||
from flask import Flask | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def hello(): | ||
return 'Hello world!' | ||
return cv2.__version__ | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0') |