Add docker
This commit is contained in:
parent
8000087896
commit
d7cac9813b
12
.dockerignore
Normal file
12
.dockerignore
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# vi: ft=gitignore
|
||||||
|
|
||||||
|
# Exclude everything
|
||||||
|
*
|
||||||
|
|
||||||
|
# Make exceptions for what's needed
|
||||||
|
!src
|
||||||
|
!requirements.lock
|
||||||
|
!requirements-dev.lock
|
||||||
|
!pyproject.toml
|
||||||
|
!LICENSE.txt
|
||||||
|
!README.md
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir uv
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY pyproject.toml README.md LICENSE.txt requirements.lock ./
|
||||||
|
RUN uv pip install --no-cache --system -r requirements.lock
|
||||||
|
|
||||||
|
# Copy the rest of the files last, to optimize rebuilds
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["uvicorn"]
|
||||||
|
CMD ["--host", "0.0.0.0", "--port", "8000", "src.__init__:app"]
|
26
docker-compose.yml
Normal file
26
docker-compose.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
services:
|
||||||
|
mongodb:
|
||||||
|
image: mongo:7
|
||||||
|
environment:
|
||||||
|
MONGO_INITDB_ROOT_USERNAME: root
|
||||||
|
MONGO_INITDB_ROOT_PASSWORD: password123
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
depends_on:
|
||||||
|
- mongodb
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
MONGODB_URI: mongodb://root:password123@mongodb:27017/db?authSource=admin
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
- default
|
||||||
|
|
||||||
|
networks:
|
||||||
|
net:
|
Loading…
Reference in a new issue