[Python] Debug Mode On in Flask when deployed with Docker in Local

Discussão em 'Python' iniciado por Stack, Março 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on a Flask project which I used to run locally before in debug mode with the simple flask run command.

    Now, I have to switch to a Docker environment. I am new to Docker. I have installed Docker Desktop for my Windows machine.

    The commands I use to run my project locally are: docker-compose build and docker-compose up. As you may expect, the build takes a long time.

    Now, when I make changes, the project doesn't reflect my recent changes without a new build. What should I do to have a live demo for debugging like local Flask deployment gave me?

    This is my DOCKERFILE:

    FROM python:3.12

    WORKDIR /app

    RUN apt-get -y update && apt-get install -y curl gnupg
    RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
    RUN curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
    RUN apt-get -y update && ACCEPT_EULA=Y apt-get install -y msodbcsql18

    RUN apt-get install -y \
    wkhtmltopdf \
    xvfb \
    libfontconfig \
    libxrender1 \
    libjpeg62-turbo

    COPY requirements.txt requirements.txt
    RUN pip install --no-cache-dir -r requirements.txt

    COPY . .

    CMD ["python", "run.py"]


    I read that 'Bind Mounts' could help in this in some way but the documentation doesn't really shed much light on my use case.

    Continue reading...

Compartilhe esta Página