Files
keywarden/Dockerfile

59 lines
1.6 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================
# 1. Base image — Python with system dependencies
# =============================================
FROM python:3.12-slim AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on
WORKDIR /app
# System deps for psycopg2, node (for Tailwind), etc.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
curl \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
# =============================================
# 2. Install Python dependencies
# =============================================
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install -r requirements.txt
# =============================================
# 3. Build Tailwind assets
# =============================================
# If youre using django-tailwind or npm-based Tailwind build
#COPY ./frontend ./frontend
#WORKDIR /app/frontend
#RUN npm install && npm run build
# =============================================
# 4. Collect static assets
# =============================================
WORKDIR /app
COPY ./app .
RUN python manage.py collectstatic --noinput
RUN chmod +x /app/entrypoint.sh
# =============================================
# 5. Create non-root user
# =============================================
RUN adduser --disabled-password --gecos '' djangouser
USER djangouser
EXPOSE 80
# =============================================
# 6. Launch the app
# =============================================
CMD ["./entrypoint.sh"]