Make project docker ready
This commit is contained in:
parent
c30e9377a1
commit
66c843237e
2
projects/project-3/backend/.dockerignore
Normal file
2
projects/project-3/backend/.dockerignore
Normal file
@ -0,0 +1,2 @@
|
||||
bike-data.db
|
||||
*.log
|
9
projects/project-3/backend/Dockerfile
Normal file
9
projects/project-3/backend/Dockerfile
Normal 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"]
|
@ -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.
|
@ -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
|
Loading…
Reference in New Issue
Block a user