forked from usestrix/strix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
104 lines (86 loc) · 2.76 KB
/
Copy pathDockerfile.dev
File metadata and controls
104 lines (86 loc) · 2.76 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# =============================================================================
# Strix Development Dockerfile
# =============================================================================
# Optimized for local development with Poetry, hot reloading, and volume mounts.
# Use with docker-compose.dev.yml for the best development experience.
# =============================================================================
FROM python:3.12-slim
LABEL maintainer="Strix <hi@usestrix.com>"
LABEL description="Strix Development Environment"
# Prevent Python from buffering stdout/stderr
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Set Poetry environment variables
ENV POETRY_HOME="/opt/poetry"
ENV POETRY_VIRTUALENVS_CREATE=true
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VERSION=1.8.4
# Add Poetry to PATH
ENV PATH="$POETRY_HOME/bin:$PATH"
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# Build essentials
build-essential \
gcc \
g++ \
# Git for version control
git \
# Curl for Poetry installation
curl \
# Required for some Python packages
libffi-dev \
libssl-dev \
# For Playwright browser automation
libnss3 \
libnspr4 \
libdbus-1-3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libcups2 \
libdrm2 \
libatspi2.0-0 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxrandr2 \
libgbm1 \
libxkbcommon0 \
libpango-1.0-0 \
libcairo2 \
libasound2 \
fonts-liberation \
# Useful dev tools
vim \
less \
jq \
tmux \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
# Create non-root user for development
RUN useradd -m -s /bin/bash developer \
&& mkdir -p /app \
&& chown -R developer:developer /app
WORKDIR /app
# Copy dependency files first for better layer caching
COPY --chown=developer:developer pyproject.toml poetry.lock* ./
# Switch to non-root user
USER developer
# Install dependencies (without the project itself for caching)
RUN poetry install --no-root --with dev
# Install Playwright browsers
RUN poetry run playwright install chromium
# Copy the rest of the application (this layer changes frequently)
# In development, this is typically overridden by volume mounts
COPY --chown=developer:developer . .
# Install the project in editable mode
RUN poetry install --with dev
# Set Python path for imports
ENV PYTHONPATH=/app
# Default command for development
CMD ["poetry", "run", "python", "-m", "strix.interface.main"]
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD poetry run python -c "import strix; print('healthy')" || exit 1