0

I am working on a project in Windows with docker containers. The docker-compose.yml is as follows:

version: "3"

services:
  # FLASK
  flask-dev:
    container_name: flask-dev
    hostname: flask-dev
    restart: "on-failure"
    build:
      context: ./server
    volumes:
      - ./server/:/usr/src/app/
    ports:
      - 5000:5000
      - 5678:5678
    env_file:
      - ./env/dev/flask.env
    networks: 
      - appnetwork
      - dbnetwork
      - elknetwork

Contents of nginx.conf as follows:

upstream flask {
    server flask-prod:8000;
}

server {
    listen 80;

    location /static {
        alias /usr/src/app/static;
    }

    location / {
        proxy_pass http://flask;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout 300;
        proxy_read_timeout 300;
    }
}

The contents of Dockerfile are:

FROM python:3.7-slim

ENV APP_HOME /usr/src/app
WORKDIR ${APP_HOME}

# Initial setup
RUN apt-get update && apt-get install -y netcat
COPY ./requirements.txt .
RUN pip install -r requirements.txt
RUN mkdir -p /home/vagrant/app-data/

# Copy all files
COPY . .

# Run entrypoint checks
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]

And the contents of entrypoint.sh are:

#!/bin/sh

echo "Running Prettier checks"
npx prettier --check .
# npx prettier --list-different --write .

echo "Starting app"
npm start

I have tried changing npm start in entrypoint.sh to npm start dev:watch and also to set the environment: - DEBUG=True in docker-compose.yml but it does not work. Any changes in the index.html file are not reflected until I stop the docker container and start again. Is there a simple way to fix this problem?

My windows version is 10.0.19043.1237 and docker version is 4.1.0

I found this but it did not fix my problem. This solution involves an external tool.

Vipin Verma
  • 5,330
  • 11
  • 50
  • 92

0 Answers0