Agree, the only disadvantage is the cold start of the Containers. After some time of inactivity the container needs a couple of seconds to respond again. Thats why i use digitalocean for small Projects. I‘ve created a docker Image to easily Host fastai2 Models (also works with Google Cloud Run). Hosting starts at 5$ per Month. Here is my Blog and the repo:
that’s awesome, thank you! I’m trying to set up a web app on Digital Ocean. To make things easy, I wanted to test a finished app that’s based on the Render fastai template.
The setup worked flawlessly, but I can’t access it via the web. I suppose something is wrong with the port setup? I don’t use nginx, so the docker container should be accessed directly, right?
I’m a bit overwhelmed. I see the ports defined four times:
In the Dockerfile (EXPOSE 2375) (5000 in the Render example)
In the server.py file uvicorn.run(app=app, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)), log_level="info")
Building the container $ PORT=8080 && docker build -f Dockerfile -t <repo:tag> .
Running the container $ docker run -d -p 8080:8080 --name=<name> <repo:tag>
The docs say that the firewall only allows access through ports 2375/2376. How can I use these?
usually docker should take care of the firewall rules - but I actually haven’t tried to deploy just the fastai-rest part on DigitalOcean. I guess with $PORT in the Dockerfile and PORT=8080 in the build command it should be working. (Image running on port 8080 and exposed on Port 8080).
EXPOSE $PORT
Using the PORT variable (in the Dockerfile, uvicorn.run and hence the build command) is required for Google Cloud Run to work.
But anyway glad that your app is working and that my Blog was useful. Awesome app
Florian