I put together a FastAPI using docker-compose.
So far it has been working nicely, but at some point the autoreload feature just stopped working, which slows down development - now it only detects changes after one minute or longer.
I have no clue what might have caused this behavior, I have not edited any of the docker settings, I have even gone back to previously working git-branches and rebuilt the images from scratch. I think it might be related to a recent Docker Desktop update - in that case, is there a way to revert to the previous working state?
This is my dc
version: "3"
services:
api:
build:
context: ./app
env_file:
- ./.env
command: bash -c "uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
volumes:
- .:/code
ports:
- "8000:8000"
...and my Dockerfile
FROM python:3.7
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV CODE_SRC=app
WORKDIR /code/
ENV PATH=$PATH:/code/
ENV PYTHONPATH=$PYTHONPATH:/code/
ENV REQUIRED_PACKAGES git pkg-config
COPY pyproject.toml poetry.lock ./
RUN set -ex; \
apt-get update ; \
apt-get install -y --no-install-recommends $REQUIRED_PACKAGES ; \
pip install poetry ; \
poetry config virtualenvs.create false ; \
poetry install --no-interaction --no-ansi ; \
apt-get autoremove -y ; \
apt-get clean -y ; \
rm -rf /var/lib/apt/lists/*
COPY . .
EXPOSE 8000
Docker desktop for windows version.
Thanks,
