nickjj / docker-django-example

A production ready example Django app that's using Docker and Docker Compose.
MIT License
1.17k stars 249 forks source link

tailwindcss --watch is not detecting changes #17

Closed terencetwuo closed 2 years ago

terencetwuo commented 2 years ago

Hi Nick,

I have came across an unexpected behavior where tailwindcss ... --watch is not detecting changes, following are steps to reproduce:

  1. git clone, cp .env.example .env, cp docker-compose.override.example.yml docker-compose.override.yml
  2. docker-compose up --build

image

image

  1. make changes in ../src/pages/templates/pages/home.html image

  2. no ~changes~ Rebuilding activity is observed in docker logs -f hellodjango_css_1.

Forked repo: https://github.com/terencetwuo/docker-django-example/commit/ea53c777b3cbb21d31ad8f5929be26638b27c191

Any help is much appreciated.

nickjj commented 2 years ago

Hi,

Based on the window style in your second screenshot and it taking 735ms, are you running Windows with WSL 2 where you have all of your source code in Windows and are accessing it in WSL 2 through the Windows mounted directory?

Try adding your source code directly into WSL 2 and ditching the mount. It'll be over 10x faster and it's possible that things may self resolve. For context I am using WSL 2 here and if I paste your line from your fork it updates here and I see a dark red border around the entire link (you had border not border-b in your fork).

terencetwuo commented 2 years ago

Hi Nick,

You have made a good point, I have proceeded to moving my source code directly into WSL2 directory https://docs.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems .

However, I'm now facing below error:

ERROR: Invalid interpolation format for "build" option in service "x-app": "DEBUG=${DEBUG:-false}"

It seems to be a problem with docker-compose version, may I know which docker-compose version should I specify?

nickjj commented 2 years ago

What version are you using? You can check with docker-compose --version.

terencetwuo commented 2 years ago

Hi, this is the version I'm using in my WSL2:

docker-compose version 1.21.0, build 5920eb0

nickjj commented 2 years ago

Ok cool, upgrading to 1.27+ will fix things for you. 1.21 is from 2018 and is missing a number of features that this repo depends on. Are you using Docker Desktop or did you install Docker manually within WSL 2?

If you're using Docker Desktop you can update Docker Desktop to the latest version to get the latest stable releases of Docker and Docker Compose.

If you installed Docker manually inside of WSL 2 then you can follow the Linux instructions to download the latest Docker Compose 1.x release in the Linux tab at https://docs.docker.com/compose/install/.

At the time of making this comment that should leave you with Docker Compose 1.29.X and then everything should work.

terencetwuo commented 2 years ago

I have updated my Docker Desktop to 4.6.0. Also updated my docker-compose inside WSL2 to latest (docker-compose version 1.29.2, build 5becea4c).

I'm now facing this issue: image

nickjj commented 2 years ago

Since you used a Windows volume mount before moving everything to WSL 2 all of your files are owned by root and now the project can't write to those files without root (the Dockerfile runs everything as a non-root user).

The easiest thing to do would be to delete the directory and clone the repo again.

terencetwuo commented 2 years ago

The issue has been resolved. Thank you for all the help!