-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (66 loc) · 2.88 KB
/
Copy pathDockerfile
File metadata and controls
76 lines (66 loc) · 2.88 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
# Docker Development Environment Image
# Base: Python 3.12-slim
# Includes: Development tools, Node.js LTS, and AI coding assistants
#
# This image provides a containerized development environment with:
# - Python 3.12 runtime
# - Node.js LTS
# - AI coding tools (Claude Code, OpenAI Codex, etc.)
# - Common development utilities
FROM python:3.12-slim
# Set working directory
# All commands will run in this directory by default
WORKDIR /workspace
# Configure package repository mirror (Aliyun for faster downloads in China)
# Falls back to standard Debian repositories if Aliyun configuration fails
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || \
(echo "deb https://mirrors.aliyun.com/debian/ bookworm main" > /etc/apt/sources.list && \
echo "deb https://mirrors.aliyun.com/debian/ bookworm-updates main" >> /etc/apt/sources.list && \
echo "deb https://mirrors.aliyun.com/debian-security/ bookworm-security main" >> /etc/apt/sources.list)
# Install essential development tools
# - git: Version control
# - vim: Text editor
# - curl, wget: Network utilities
# - build-essential: Compilation tools (gcc, make, etc.)
# - sudo: Privilege escalation
# Clean apt cache to reduce image size
RUN apt-get update && apt-get install -y \
git \
vim \
curl \
wget \
build-essential \
sudo \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js LTS version
# Uses NodeSource repository for official LTS releases
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install AI coding assistant tools globally
# - @anthropic-ai/claude-code: Claude Code CLI tool
# - @openai/codex: OpenAI Codex CLI tool
# - opencode-ai: OpenCode AI CLI tool
RUN npm i -g @anthropic-ai/claude-code
RUN npm i -g @openai/codex
RUN npm i -g opencode-ai
# Create non-root user for development
# This is a security best practice - avoid running as root when possible
# The user has sudo privileges without password prompt for convenience
RUN useradd -m -s /bin/bash developer && \
echo "developer ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Configure Git safe.directory for /workspace
# This fixes Git 2.35.2+ security feature that prevents operations
# when directory ownership doesn't match the current user
# This is needed when mounting host directories into the container
# Configure for both root and developer user
RUN git config --global --add safe.directory /workspace && \
su - developer -c "git config --global --add safe.directory /workspace" || true
# Set Python environment variables
# PYTHONUNBUFFERED: Disable Python output buffering for real-time logs
# PYTHONDONTWRITEBYTECODE: Prevent Python from creating .pyc files
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Default command: Start bash shell
# This allows interactive use of the container
CMD ["/bin/bash"]