2025-07-10 12:11:44 -07:00
|
|
|
FROM node:24-slim
|
2025-04-16 12:56:08 -04:00
|
|
|
|
|
|
|
|
ARG TZ
|
|
|
|
|
ENV TZ="$TZ"
|
|
|
|
|
|
2025-04-17 19:42:14 +05:30
|
|
|
# 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 \
|
2025-04-16 12:02:41 -07:00
|
|
|
aggregate \
|
2025-04-17 19:42:14 +05:30
|
|
|
ca-certificates \
|
|
|
|
|
curl \
|
2025-04-16 12:02:41 -07:00
|
|
|
dnsutils \
|
|
|
|
|
fzf \
|
|
|
|
|
gh \
|
2025-04-16 12:56:08 -04:00
|
|
|
git \
|
2025-04-16 12:02:41 -07:00
|
|
|
gnupg2 \
|
|
|
|
|
iproute2 \
|
|
|
|
|
ipset \
|
|
|
|
|
iptables \
|
|
|
|
|
jq \
|
|
|
|
|
less \
|
|
|
|
|
man-db \
|
2025-04-16 12:56:08 -04:00
|
|
|
procps \
|
|
|
|
|
unzip \
|
2025-04-16 12:02:41 -07:00
|
|
|
ripgrep \
|
2025-04-17 19:42:14 +05:30
|
|
|
zsh \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2025-04-16 12:56:08 -04:00
|
|
|
|
|
|
|
|
# Ensure default node user has access to /usr/local/share
|
|
|
|
|
RUN mkdir -p /usr/local/share/npm-global && \
|
|
|
|
|
chown -R node:node /usr/local/share
|
|
|
|
|
|
|
|
|
|
ARG USERNAME=node
|
|
|
|
|
|
|
|
|
|
# Set up non-root user
|
|
|
|
|
USER node
|
|
|
|
|
|
|
|
|
|
# Install global packages
|
|
|
|
|
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
|
|
|
|
ENV PATH=$PATH:/usr/local/share/npm-global/bin
|
|
|
|
|
|
|
|
|
|
# Install codex
|
|
|
|
|
COPY dist/codex.tgz codex.tgz
|
2025-04-17 19:42:14 +05:30
|
|
|
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
|
2025-04-16 12:56:08 -04:00
|
|
|
|
2025-04-28 07:48:38 -07:00
|
|
|
# Inside the container we consider the environment already sufficiently locked
|
|
|
|
|
# down, therefore instruct Codex CLI to allow running without sandboxing.
|
|
|
|
|
ENV CODEX_UNSAFE_ALLOW_NO_SANDBOX=1
|
|
|
|
|
|
2025-04-24 14:25:02 -07:00
|
|
|
# Copy and set up firewall script as root.
|
2025-04-16 12:56:08 -04:00
|
|
|
USER root
|
2025-04-24 14:25:02 -07:00
|
|
|
COPY scripts/init_firewall.sh /usr/local/bin/
|
|
|
|
|
RUN chmod 500 /usr/local/bin/init_firewall.sh
|
|
|
|
|
|
|
|
|
|
# Drop back to non-root.
|
2025-04-16 12:02:41 -07:00
|
|
|
USER node
|