dockerfix
This commit is contained in:
35
Dockerfile
35
Dockerfile
@@ -1,5 +1,6 @@
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
||||
|
||||
# 🔧 System dependencies layer (cached unless OS changes)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
postgresql-client \
|
||||
git \
|
||||
@@ -9,33 +10,33 @@ RUN apt-get update && apt-get install -y \
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 📦 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
|
||||
|
||||
# Создаем папку для кеша HuggingFace моделей
|
||||
# 🧠 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
|
||||
|
||||
# Install only transitive deps first (cache-friendly layer)
|
||||
COPY pyproject.toml .
|
||||
COPY uv.lock .
|
||||
RUN uv sync --no-install-project
|
||||
# 🐍 Python dependencies layer (cached unless pyproject.toml/uv.lock changes)
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-install-project
|
||||
|
||||
# Add project sources and finalize env
|
||||
COPY . .
|
||||
RUN uv sync --no-editable
|
||||
|
||||
# Установка Node.js LTS и npm
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
|
||||
apt-get install -y nsolid \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm upgrade -g npm
|
||||
# 📦 Node.js dependencies layer (cached unless package*.json changes)
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
RUN npm ci --only=production
|
||||
|
||||
# 🚀 Application code and final setup (rebuilt on any code change)
|
||||
COPY . .
|
||||
RUN uv sync --frozen --no-editable
|
||||
|
||||
# 🏗️ Frontend build (cached unless frontend code changes)
|
||||
RUN npm run build
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user