Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

280
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!