Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda