Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# ARM64/Apple Silicon compatible Dockerfile
FROM --platform=linux/arm64 python:3.12-slim AS base

# For ARM compatibility, use explicit platform
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONOPTIMIZE=2

# Update packages and install core dependencies
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
ca-certificates \
wget \
curl \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Install Python computer vision dependencies
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgthread-2.0-0 \
&& rm -rf /var/lib/apt/lists/*

# Install X11 and basic tools (minimal set for ARM compatibility)
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
xvfb \
x11-utils \
scrot \
imagemagick \
&& rm -rf /var/lib/apt/lists/*

# Try to install xdotool (may not be available on all ARM repos)
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
xdotool || echo "xdotool not available on this ARM platform"

# Try to install FreeRDP (may have different package name on ARM)
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
freerdp2-x11 || \
apt-get install -y --no-install-recommends freerdp-x11 || \
echo "FreeRDP not available, OCR testing will still work"

RUN rm -rf /var/lib/apt/lists/*

# ---------- Builder stage ----------
FROM base AS builder
COPY --from=ghcr.io/astral-sh/uv:0.8.13 /uv /usr/local/bin/uv
WORKDIR /app

COPY pyproject.toml /app/
RUN --mount=type=cache,target=/root/.cache/uv uv lock
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-install-project --no-dev

COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv uv sync --frozen --no-dev

# Install debugpy for remote debugging
RUN --mount=type=cache,target=/root/.cache/uv uv add debugpy

# ---------- Runtime stage ----------
FROM base AS runtime
WORKDIR /app

# Copy uv binary from builder stage
COPY --from=builder /usr/local/bin/uv /usr/local/bin/uv

RUN useradd -m -u 10001 appuser
COPY --from=builder /app /app
ENV PATH="/app/.venv/bin:${PATH}"

ENV DISPLAY=:99
RUN mkdir -p /tmp/screenshots && chown appuser:appuser /tmp/screenshots

USER appuser
CMD ["bash"]
42 changes: 28 additions & 14 deletions Dockerfile.rdp
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,46 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONOPTIMIZE=2

# Install system deps for computer vision and RDP
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
# Update package lists first
RUN apt-get update -qq

# Install system deps for computer vision and RDP in separate steps
RUN apt-get install -y --no-install-recommends \
ca-certificates \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgl1-mesa-glx \
libgthread-2.0-0 \
# RDP-specific dependencies
freerdp2-x11 \
libgthread-2.0-0

# Install X11 and display tools
RUN apt-get install -y --no-install-recommends \
xvfb \
xdotool \
imagemagick \
netbase-client \
# X11 utilities for RDP screen capture
x11-apps \
x11-utils \
xdotool

# Install RDP and screenshot tools
RUN apt-get install -y --no-install-recommends \
freerdp2-x11 \
scrot \
# Additional tools for image processing
netpbm \
&& rm -rf /var/lib/apt/lists/*
imagemagick

# Install network tools (try different package name if needed)
RUN apt-get install -y --no-install-recommends \
netbase || apt-get install -y --no-install-recommends inetutils-ping

# Install image processing tools
RUN apt-get install -y --no-install-recommends \
netpbm

# Clean up
RUN rm -rf /var/lib/apt/lists/*

# Configure ImageMagick security policy for screenshot conversion
RUN sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml && \
RUN sed -i 's/rights="none" pattern="PDF"/rights="read|write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml || true && \
sed -i 's/rights="none" pattern="XWD"/rights="read|write" pattern="XWD"/g' /etc/ImageMagick-6/policy.xml || true

# ---------- Builder: uv + lock + install (no dev) ----------
Expand Down Expand Up @@ -83,7 +97,7 @@ EXPOSE 8000

# Health check to verify RDP dependencies
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD xfreerdp --version > /dev/null 2>&1 || exit 1
CMD which xfreerdp > /dev/null 2>&1 || exit 1

# Default command: run the VM automation CLI with RDP
CMD ["uv", "run", "vm-automation", "--connection", "rdp"]
Loading
Loading