Docker

Dockerfile

FROM python:3.10

WORKDIR /code/app

COPY ./requirements.txt /code/requirements.txt

RUN apt update
RUN apt install nano
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY ./app /code/app

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8001"]

docker-compose.yml

version: "3.9"
services:
  app_name:
    image: image_name:version
    container_name: container_name
    volumes:
      - ./logs:/usr/src/app/logs 
    environment:
      DB_URL: ${DB_URL}
    restart: always
    ports:
      - 8001:8001

Last updated