Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

chore: reduce docker image size (#194)

Mahesh Rijalb6e3f3f8dd8f
diff --git a/codex-cli/Dockerfile b/codex-cli/Dockerfile
index 95fe3800ec..5f89420372 100644
--- a/codex-cli/Dockerfile
+++ b/codex-cli/Dockerfile
@@ -1,11 +1,13 @@
-FROM node:20
+FROM node:20-slim
ARG TZ
ENV TZ="$TZ"
-# Install basic development tools and iptables/ipset
-RUN apt update && apt install -y \
+# Install basic development tools, ca-certificates, and iptables/ipset, then clean up apt cache to reduce image size
+RUN apt-get update && apt-get install -y --no-install-recommends \
aggregate \
+ ca-certificates \
+ curl \
dnsutils \
fzf \
gh \
@@ -21,7 +23,8 @@ RUN apt update && apt install -y \
sudo \
unzip \
ripgrep \
- zsh
+ zsh \
+ && rm -rf /var/lib/apt/lists/*
# Ensure default node user has access to /usr/local/share
RUN mkdir -p /usr/local/share/npm-global && \
@@ -38,7 +41,11 @@ ENV PATH=$PATH:/usr/local/share/npm-global/bin
# Install codex
COPY dist/codex.tgz codex.tgz
-RUN npm install -g codex.tgz
+RUN npm install -g codex.tgz \
+ && npm cache clean --force \
+ && rm -rf /usr/local/share/npm-global/lib/node_modules/codex-cli/node_modules/.cache \
+ && rm -rf /usr/local/share/npm-global/lib/node_modules/codex-cli/tests \
+ && rm -rf /usr/local/share/npm-global/lib/node_modules/codex-cli/docs
# Copy and set up firewall script
COPY scripts/init_firewall.sh /usr/local/bin/