-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.app
More file actions
85 lines (70 loc) · 3.31 KB
/
Dockerfile.app
File metadata and controls
85 lines (70 loc) · 3.31 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
# =============================================================================
# AI Code Executor - Application Container
# =============================================================================
# This Dockerfile packages the entire AI Code Executor application.
# It requires Docker socket access to create code execution containers.
# =============================================================================
FROM python:3.11-slim
LABEL maintainer="AI Code Executor"
LABEL description="AI Code Executor - Execute code with AI assistance in Docker containers"
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# =============================================================================
# Install System Dependencies
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
# Docker CLI (to communicate with host Docker via socket)
curl \
gnupg \
lsb-release \
ca-certificates \
# FFmpeg for Whisper audio processing
ffmpeg \
# Build tools for Python packages
build-essential \
gcc \
# Cleanup
&& rm -rf /var/lib/apt/lists/*
# Install Docker CLI only (we use host's Docker daemon via socket)
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y --no-install-recommends docker-ce-cli && \
rm -rf /var/lib/apt/lists/*
# =============================================================================
# Set Up Application
# =============================================================================
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY backend/ ./backend/
COPY frontend/ ./frontend/
COPY Dockerfile ./Dockerfile
COPY .env.example ./.env.example
# Create directories for data persistence
RUN mkdir -p /app/data /app/docker_images_exported
# =============================================================================
# Configuration
# =============================================================================
# Default environment variables
ENV HOST=0.0.0.0
ENV PORT=8000
ENV DATABASE_URL=sqlite+aiosqlite:///./data/conversations.db
ENV DOCKER_EXPORT_PATH=/app/docker_images_exported
# Expose the web interface port
EXPOSE 8000
# =============================================================================
# Health Check
# =============================================================================
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/api/health || exit 1
# =============================================================================
# Entrypoint
# =============================================================================
# Use exec form for proper signal handling
CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]