Tailwind-Django not working in Docker Container

I'm trying to deploy a django application on https://render.com/ using Docker. Unfortunately, the Tailwind classes don't work. In development, they work perfectly.

Dockerfile:

FROM python:3.12

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

# Set the working directory
WORKDIR /app

# Install Node.js and npm
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
    apt-get install -y nodejs

# Install Poetry
RUN pip install poetry

# Copy pyproject.toml and poetry.lock
COPY pyproject.toml poetry.lock /app/

# Configure Poetry to not use virtualenvs
RUN poetry config virtualenvs.create false

# Install Python dependencies
RUN poetry install --no-dev

# Copy the entire project
COPY . /app/

# Install Tailwind CSS (requires Node.js and npm)
RUN python manage.py tailwind install --no-input

# Build Tailwind CSS
RUN python manage.py tailwind build --no-input

# Collect static files
RUN python manage.py collectstatic --no-input

# Expose port 8000
EXPOSE 8000

# Start the application with Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "config.wsgi:application"]

I tried changing the order of the manage.py commands and clearing the cache. But that didn't help.

Back to Top