Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

277
Vistas
How to make FASTAPI pickup changes in an API routing file automatically while running inside a docker container?

I am running FastApi via docker by creating a sevice called ingestion-data in docker-compose. My Dockerfile :

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7

# Environment variable for directory containing our app
ENV APP /var/www/app
ENV PYTHONUNBUFFERED 1

# Define working directory
RUN mkdir  -p $APP
WORKDIR $APP
COPY . $APP

# Install missing dependencies
RUN pip  install -r requirements.txt

AND my docker-compose.yml file

version: '3.8'

services:
    ingestion-service:
        build:
            context: ./app
            dockerfile: Dockerfile
        ports:
            - "80:80"
        volumes:
            - .:/app
        restart: always

I am not sure why this is not picking up any change automatically when I make any change in any endpoint of my application. I have to rebuild my images and container every time.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Quick answer: Yes :)

In the Dockerfile, you copying your app into /var/www/app.
The instructions form the Dockerfile are executed when you build your image (docker build -t <imgName>:<tag>)
If you change the code later on, how could the image be aware of that?

However, you can mount a volume(a directory) from your host machine, into the container when you execute the docker run / docker-compose up command, right under /var/www/app. You'll then be able to change the code in your local directory and the changes will automatically be seen in the container as well.

Perhaps you want to mount the current working directory(the one containing your app) at /var/www/app?

volumes:
  - .:/var/www/app
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda