-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerFile.python
More file actions
55 lines (43 loc) · 1.68 KB
/
DockerFile.python
File metadata and controls
55 lines (43 loc) · 1.68 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
# For Python environment
FROM codex
USER root
# --- Python runtime & packaging ---
RUN apk add --no-cache \
python3 py3-pip py3-setuptools py3-wheel
# --- Create a writable venv for coder ---
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv --system-site-packages "$VIRTUAL_ENV" \
&& "$VIRTUAL_ENV/bin/python" -m pip install --no-cache-dir -U pip setuptools wheel \
&& chown -R coder:coder "$VIRTUAL_ENV"
# Ensure login shells keep the venv on PATH
RUN printf '%s\n' \
'export VIRTUAL_ENV=/opt/venv' \
'export PATH="/opt/venv/bin:$PATH"' \
> /etc/profile.d/venv.sh
# Ensure venv is the default python/pip for all processes (including Codex runs)
ENV PATH="$VIRTUAL_ENV/bin:$PATH" \
PIP_DISABLE_PIP_VERSION_CHECK=1
RUN mkdir -p /etc/codexctl \
&& BUILD_TIME="$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
&& cat > /etc/codexctl/image.md <<EOF
You are running inside the \`codex-python\` image.
Environment:
- containerized Alpine Linux (package manager \`apk\`)
- running as the non-root user \`coder\`
- shared host workspace at \`/workdir\`
- architecture: check with \`uname -m\` if needed
Image metadata:
- image: \`codex-python\`
- built_at_utc: \`${BUILD_TIME}\`
Built-in CLI tools:
- base tools: \`bash\`, \`zsh\`, \`git\`, \`curl\`, \`file\`, \`jq\`, \`rg\`
- programming tools: \`node\`, \`npm\`, \`python3\`, \`python\`, \`pip\`
Programming environments:
- Node.js with npm
- Python 3
- default virtual environment at \`/opt/venv\`, already on \`PATH\`
Prefer the default \`/opt/venv\` environment for Python package installs and script execution unless the user asks for a project-local virtualenv.
EOF
RUN ln -sf /etc/codexctl/image.md /home/coder/.codex/AGENTS.md
USER coder
WORKDIR /workdir