-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (53 loc) · 1.79 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (53 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# --- STAGE 1: Builder ---
FROM python:3.12-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
ENV UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
DEBIAN_FRONTEND=noninteractive
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
libvips-dev \
&& rm -rf /var/lib/apt/lists/*
# Install dependencies first (layer caching)
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
uv sync --frozen --no-install-project --all-extras
# Copy source and install project
COPY . .
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --all-extras
# --- STAGE 2: Runtime ---
FROM python:3.12-slim AS runtime
WORKDIR /app
# Install runtime system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg \
libvips42 \
curl \
ca-certificates \
gnupg \
&& curl -1sLf 'https://artifacts-cli.infisical.com/setup.deb.sh' | bash \
&& apt-get update && apt-get install -y infisical \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy virtualenv from builder
COPY --from=builder /app/.venv /app/.venv
# Copy source code
COPY morphosx /app/morphosx
# Add virtualenv to PATH
ENV PATH="/app/.venv/bin:$PATH"
# Set environment defaults
ENV MORPHOSX_PORT=6100 \
MORPHOSX_STORAGE_TYPE="local" \
MORPHOSX_ENGINE_TYPE="vips" \
MORPHOSX_STORAGE_PATH="/app/storage"
# Create storage directories
RUN mkdir -p storage/originals storage/cache storage/users
# Expose FastAPI custom port
EXPOSE 6100
# Run the application
CMD ["uvicorn", "morphosx.app.main:app", "--host", "0.0.0.0", "--port", "6100"]