Search code examples
cssdockerdocker-composetailwind-cssremix.run

Dockerized remix.run app doesn't recompile tailwind assets when running in dev mode


I'm working on a remix app that makes use of Hanko for passkey-based authentication. In order to troubleshoot and unit-test auth issues, it's necessary to run a hanko backend locally in dev mode. I've created a docker compose setup for this. Everything is mostly working, except every once in a while, the Tailwind JIT doesn't always seem to recompile certain assets after I make changes. It works just fine if I'm running npm run dev outside of docker, but inside docker, it sometimes fails to update and my style changes don't show up. Here is my dockerfile for dev mode. Does anything stick out to you as being wrong here? Thanks in advance for your time.

FROM node:18-bullseye-slim

WORKDIR /myapp

# set for base and all layer that inherit from it
ENV NODE_ENV development
ENV PORT 3000
ENV DATABASE_URL file:./data.db?connection_limit=1
ENV HANKO_URL http://localhost:8000
ENV HANKO_BACKEND_URL http://hanko-backend:8000

# Install openssl for Prisma
RUN apt-get update && apt-get upgrade -y && apt-get install -y openssl sqlite3 curl

# Install all node_modules, including dev dependencies
ADD package.json .npmrc ./
RUN npm install

ADD . ./
RUN npx prisma migrate reset --force

# TODO figure out why tailwind doesn't always get updated
RUN npm run build
CMD ["npm", "run", "dev"]

Solution

  • I ultimately resolved this issue by creating a new remix app and then importing my existing code base into it one chunk at a time. After doing that, my dockerized setup seemed to recompile all assets properly using live reload.