dockerfix-3-versions-bump
This commit is contained in:
29
Dockerfile
29
Dockerfile
@@ -1,4 +1,5 @@
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
||||
# 🏗️ Multi-stage build for optimal caching and size
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim as builder
|
||||
|
||||
# 🔧 System dependencies layer (cached unless OS changes)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@@ -18,6 +19,24 @@ RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 📦 Node.js dependencies layer (cached unless package*.json changes)
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# 🏗️ Frontend build (build with all dependencies)
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# 🚀 Production stage
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
||||
|
||||
# 🔧 Runtime dependencies only
|
||||
RUN apt-get update && apt-get install -y \
|
||||
postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 🧠 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
|
||||
@@ -27,16 +46,12 @@ ENV HF_HOME=/app/.cache/huggingface
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-install-project
|
||||
|
||||
# 📦 Node.js dependencies layer (cached unless package*.json changes)
|
||||
COPY package.json package-lock.json ./
|
||||
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
|
||||
# 📦 Copy built frontend from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user