scraped-tvtime-api icon indicating copy to clipboard operation
scraped-tvtime-api copied to clipboard

Dockerization

Open IAM-marco opened this issue 5 years ago • 4 comments

Having to start your own Flask server is not ideal. What if the project could be dockerized and one could just launch the container and have the API exposed and ready to handle requests?

Remarks

  • Server session secret key should be passed in some way down to the flask app
  • Maybe should deal with SSL certificates?

IAM-marco avatar Jun 23 '20 15:06 IAM-marco

  • [ ] Points above
  • [ ] Automate release on dockerhub
  • [ ] Automate release on github

IAM-marco avatar Jul 14 '20 15:07 IAM-marco

Hi, I just tested out a docker setup of your project. It's pretty straight forward and works out of the box. Add a Dockerfile to your repo with the following:

FROM python:3.8-slim-buster
COPY . /app
WORKDIR /app
RUN pip3 install -r requirements.txt
CMD export FLASK_APP=/app/src/main.py ; python3 -m flask run --cert=adhoc --host=0.0.0.0

And add pyOpenSSL in requirements.txt for cert support. --cert=adhoc starts the server with https instead of http

All of the files are available as is in the docker image.

image

In docker hub you can just add auto build and select the github repo and everything will sync up nicely.

ShrinkWrapper avatar Apr 11 '21 00:04 ShrinkWrapper

Thanks for the heads up! This is indeed a good starting point! ^^

IAM-marco avatar Apr 11 '21 11:04 IAM-marco

No worries and thank you for your project!

ShrinkWrapper avatar Apr 11 '21 11:04 ShrinkWrapper