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

285
Vistas
npm run dev doesn't auto-reload inside docker container

I've been struggling with a situation for the past day, and I couldn't really find anything that helped me solve it:

I have a Svelte + Flask project that I've been running directly on my host for a while, but I've recently decided to dockerize both the frontend and backend service into the same container.

Now, when developing the frontend part, I used npm run dev to start the frontend service and have it reload every time I made changes to the code. Problem is, when I run the same thing inside the container nothing happens when I update the code. I do know for sure that code I write on the host gets put into the container using the volume defined in the docker-compose.

I'm honestly pretty new to containerization in general, so I wouldn't be surprised if it is something I missed.

For reference, here's my Dockerfile:

FROM nikolaik/python-nodejs:python3.9-nodejs16-slim

WORKDIR /opt/myproject

COPY . .

RUN pip3 install -r server/requirements.txt
RUN cd client && npm install && npm run-script build

EXPOSE 5000
ENV FLASK_ENV="development"
ENV FLASK_APP="/opt/myproject/server/src/start.py"

CMD ["/bin/sh", "/opt/myproject/start_services.sh"]

I've made a script to run both Gunicorn on backend in addition to npm run dev:

#!/bin/sh
cd /opt/myproject/server/src
gunicorn --bind 0.0.0.0:5000 --reload --daemon start:app 
cd /opt/myproject/client
npm run dev

Here's my compose, if it is also needed:

# docker-compose.yml
version: '3.9'

services:
  web:
    image: myproject_main
    container_name: myproject_main_container
    ports:
     - "5000:5000"
    dns:
     - 8.8.8.8
    volumes:
     - ./myproject_code:/opt/myproject
  


networks:
  default:
    external: true
    name: myproject_net

Thanks a lot!

about 4 years ago · Juan Pablo Isaza
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