41 lines
No EOL
897 B
Docker
41 lines
No EOL
897 B
Docker
# Multi-stage build for a Python backend with Deno frontend
|
|
|
|
# Stage 1: Build the frontend
|
|
FROM denoland/deno:2.4.3 AS frontend-builder
|
|
|
|
# Set working directory for frontend
|
|
WORKDIR /app/frontend
|
|
|
|
# Copy frontend files
|
|
COPY frontend/ .
|
|
|
|
# Install dependencies and build the frontend
|
|
RUN deno install --allow-scripts
|
|
RUN deno run build
|
|
|
|
# Stage 2: Setup Python backend with uv
|
|
FROM python:3.11-slim AS backend
|
|
|
|
# Install uv
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy Python project files
|
|
COPY pyproject.toml uv.lock ./
|
|
|
|
# Install Python dependencies
|
|
RUN uv sync --frozen
|
|
|
|
# Copy backend source code
|
|
COPY *.py ./
|
|
|
|
# Copy built frontend from previous stage
|
|
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
|
|
|
|
# Expose the port (adjust if your app uses a different port)
|
|
EXPOSE 8000
|
|
|
|
# Run the application
|
|
CMD ["uv", "run", "app.py"] |