Files
core/Dockerfile

44 lines
1.3 KiB
Docker
Raw Normal View History

FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
2025-02-10 19:10:13 +03:00
2025-09-10 11:00:46 +03:00
# 🔧 System dependencies layer (cached unless OS changes)
2025-02-10 19:10:13 +03:00
RUN apt-get update && apt-get install -y \
postgresql-client \
git \
2025-02-10 19:10:13 +03:00
curl \
2025-05-18 22:43:20 +00:00
build-essential \
2025-05-26 09:39:59 +03:00
gnupg \
ca-certificates \
2025-02-10 19:10:13 +03:00
&& rm -rf /var/lib/apt/lists/*
2025-09-10 11:00:46 +03:00
# 📦 Install Node.js LTS (cached until Node.js version changes)
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& npm upgrade -g npm
WORKDIR /app
2025-09-10 11:00:46 +03:00
# 🧠 ML models cache setup (cached unless HF environment changes)
RUN mkdir -p /app/.cache/huggingface && chmod 755 /app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV HF_HOME=/app/.cache/huggingface
2025-09-10 11:00:46 +03:00
# 🐍 Python dependencies layer (cached unless pyproject.toml/uv.lock changes)
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-install-project
2025-09-10 11:00:46 +03:00
# 📦 Node.js dependencies layer (cached unless package*.json changes)
2025-05-26 10:04:22 +03:00
COPY package.json package-lock.json ./
2025-09-10 11:00:46 +03:00
RUN npm ci --only=production
# 🚀 Application code and final setup (rebuilt on any code change)
2025-02-10 19:10:13 +03:00
COPY . .
2025-09-10 11:00:46 +03:00
RUN uv sync --frozen --no-editable
# 🏗️ Frontend build (cached unless frontend code changes)
2025-05-26 10:47:33 +03:00
RUN npm run build
2025-05-26 09:39:59 +03:00
2025-03-20 12:33:27 +03:00
EXPOSE 8000
2025-03-20 12:24:30 +03:00
CMD ["python", "-m", "granian", "main:app", "--interface", "asgi", "--host", "0.0.0.0", "--port", "8000"]