Make project docker ready

This commit is contained in:
Marcel Schwarz 2020-12-21 03:24:12 +01:00
parent c30e9377a1
commit 66c843237e
4 changed files with 28 additions and 5 deletions

View File

@ -0,0 +1,2 @@
bike-data.db
*.log

View File

@ -0,0 +1,9 @@
FROM python:3.9
WORKDIR /app
COPY requirements.txt /app
RUN pip install -r requirements.txt
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "80"]

View File

@ -18,4 +18,16 @@ Note: The importer outputs logs to the terminal, and the db_init.log file.
## 3. Start the backend
To start the backend, you first have to initialize the database!
### Run with docker
Switch into the project directory, then run:
```shell
docker build -t geovis-backend .
```
After the build make sure you are in the same directory as "bike-data.db" resides, if so, run
```shell
docker run -v $(pwd):/app -p 8080:80 --restart always -d test
```
Note: `$(pwd)` puts the current directory in the command, if you are on Windows, you can use WSL or provide the full path by typing it out.
To stop just shut down the container.

View File

@ -1,4 +1,4 @@
requests~=2.25.1
fastapi[all]~=0.62.0
uvicorn~=0.13.1
pydantic~=1.7.3
requests
fastapi[all]
uvicorn
pydantic