saasforge / open-source-saas-boilerpate

Free SaaS boilerplate (Python/PostgreSQL/ReactJS/Webpack)
https://www.saasforge.dev
MIT License
813 stars 118 forks source link

Docker-compose with mounted repo not working properly #19

Open Rbillon59 opened 3 years ago

Rbillon59 commented 3 years ago

Hello,

First of all, very nice work here ! Thanks for sharing your work to the world.

I just cloned your repo and used docker-compose to run the app locally but i got a blank page on http://localhost:5000/auth/login. In the developer console it shown a 404 on http://localhost:5000/static/dist/auth.bundle.js

The reason is if you do not run the

npm install --global npm && \
    npm update && \
    npm install && \
    npm run dev

on your local and mount the repo in /app with your compose file, the generated js etc.. will not be there.

A quick fix would be to comment or delete the volume mount as below because you do it in the Dockerfile:

 app:
    build: .
    depends_on:
      - db
    environment:
      - FLASK_APP=${FLASK_APP:-application}
      - FLASK_ENV=${FLASK_ENV:-dev}
      - FLASK_RUN_HOST=${FLASK_RUN_HOST:-0.0.0.0}
      - jwt_secret_key=${jwt_secret_key:-FAKE_JWT_SECRET_KEY}
      - secret_key=${secret_key:-FAKE_SECRET_KEY}
      - db_url=postgres://postgres:password@db:5432/dev
    ports:
      - 5000:5000
    # volumes:
    #   - .:/app

Another solution would be to add the npm stuff in the entrypoint.sh, so it will generate everything at runtime even if you mount the repo. With this solution it will work every time, but with 1 min overhead at starting the app container.

I don't know, you know that better than me for sure !

saasforge commented 2 years ago

Great, thanks! Sorry missed this post somehow... please feel free to create a pull request.