Docker-compose with the couchdb backend

This commit is contained in:
Joseph Ferano 2023-05-19 16:20:57 +07:00
parent de85790ffa
commit 1424fb2f43
3 changed files with 34 additions and 6 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
/target
venv
__pycache__
/.env
/data/

View File

@ -1,11 +1,18 @@
FROM python:3.11
# Use an official Python runtime as a parent image
FROM python:3
WORKDIR /code
# Set the working directory in the container
WORKDIR /app
COPY ./requirements.txt /code/requirements.txt
# Install any needed packages specified in requirements.txt
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the current directory contents into the container at /app
COPY . /app/
COPY ./app /code/app
# Make port 8000 available to the world outside this container
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
# Run api.py when the container launches
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]

19
docker-compose.yml Normal file
View File

@ -0,0 +1,19 @@
version: '3'
services:
couchdb:
image: couchdb:latest
network_mode: host
volumes:
- ./data:/opt/couchdb/data:Z
env_file:
- .env
fastapi_app:
build:
context: .
dockerfile: Dockerfile
network_mode: host
depends_on:
- couchdb
env_file:
- .env