Skip to content

Commit 90b0e7d

Browse files
committed
Stabilize arch build and refresh docs
- place DisableSandbox under [options] to avoid pacman parse errors - align compose/.env defaults with build args and services - update README for env knobs, dev workflow, and Codex/Gemini usage
1 parent 7124710 commit 90b0e7d

4 files changed

Lines changed: 137 additions & 86 deletions

File tree

.env.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ DOCKER_PLATFORM=linux/amd64
1010

1111
MIRROR_LIST_COUNTRY=RU
1212
BUILD_PACKAGES="pyenv git gnupg sudo postgresql-libs mariadb-libs openmp"
13-
VIM_PACKAGES="python vim ctags ripgrep bat npm nodejs-lts-jod openai-codex gemini-cli"
13+
VIM_PACKAGES="python vim vim-spell-en vim-spell-ru ctags ripgrep bat npm nodejs-lts-jod openai-codex gemini-cli"
1414

1515
PYTHON_VERSION=3.14
1616
PYTHONUNBUFFERED=1
17-
PIP_DEFAULT_TIMEOUT=100
18-
POETRY_VERSION=2.2.1
17+
PIP_DEFAULT_TIMEOUT=300
18+
POETRY_VERSION=2.3.2
1919
POETRY_OPTIONS_APP="--only main --compile"
2020
POETRY_OPTIONS_DEV="--no-root --with dev --compile"
2121
POETRY_NO_INTERACTION=1

Dockerfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ARG DOCKER_USER_HOME=/home/devuser
77
ARG MIRROR_LIST_COUNTRY=RU
88
ARG BUILD_PACKAGES="pyenv git gnupg sudo postgresql-libs mariadb-libs openmp"
99
ARG PYTHON_VERSION=3.14
10-
ARG POETRY_VERSION=2.2.1
10+
ARG POETRY_VERSION=2.3.2
1111
RUN echo "* soft core 0" >> /etc/security/limits.conf && \
1212
echo "* hard core 0" >> /etc/security/limits.conf && \
1313
echo "* soft nofile 10000" >> /etc/security/limits.conf
@@ -36,7 +36,9 @@ RUN set -eux; \
3636
echo "WARN: mirrorlist update failed; keeping existing /etc/pacman.d/mirrorlist" >&2; \
3737
rm -f "$tmp"; \
3838
fi
39-
RUN pacman -Syu --noconfirm && \
39+
RUN grep -q '^DisableSandbox$' /etc/pacman.conf || \
40+
sed -i '/^\[options\]/a DisableSandbox' /etc/pacman.conf && \
41+
pacman -Syu --noconfirm && \
4042
pacman -S --noconfirm --needed $BUILD_PACKAGES && \
4143
pacman -Scc --noconfirm && \
4244
rm -rf /var/lib/pacman/sync/*
@@ -62,6 +64,7 @@ ENV PATH=$POETRY_HOME/bin:$PATH
6264
ENV PYTHONPATH=/application/src
6365
ENV PROJECT_ROOT=/application
6466
ENV HOME=$DOCKER_USER_HOME
67+
ENV PYTHON_VERSION=$PYTHON_VERSION
6568

6669
FROM python-base AS poetry
6770
ARG DOCKER_HOST_UID=1000
@@ -90,7 +93,7 @@ WORKDIR /application
9093

9194
FROM python-base AS build-deps-dev
9295
ARG DOCKER_USER=devuser
93-
ARG VIM_PACKAGES="python vim ctags ripgrep bat npm nodejs-lts-jod openai-codex gemini-cli"
96+
ARG VIM_PACKAGES="python vim vim-spell-en vim-spell-ru ctags ripgrep bat npm nodejs-lts-jod openai-codex gemini-cli"
9497
ARG POETRY_OPTIONS_DEV="--no-root --with-dev --compile"
9598
RUN pacman -Sy --noconfirm && \
9699
pacman -S --noconfirm --needed $VIM_PACKAGES && \
@@ -107,6 +110,8 @@ RUN mkdir -p $DOCKER_USER_HOME/.gemini && \
107110
chown -R $DOCKER_USER $DOCKER_USER_HOME/.gemini
108111
RUN mkdir -p $DOCKER_USER_HOME/.config && \
109112
chown -R $DOCKER_USER $DOCKER_USER_HOME/.config
113+
RUN mkdir -p $DOCKER_USER_HOME/.local/share/jupyter && \
114+
chown $DOCKER_USER:$DOCKER_USER $DOCKER_USER_HOME/.local/share/jupyter
110115

111116
FROM build-deps-dev AS dev-build
112117
ARG DOCKER_HOST_UID=1000
@@ -124,14 +129,6 @@ ARG DOCKER_USER_HOME=/home/devuser
124129
USER ${DOCKER_HOST_UID}:${DOCKER_HOST_GID}
125130
RUN curl -fLo $DOCKER_USER_HOME/.vim/autoload/plug.vim --create-dirs \
126131
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
127-
RUN curl -fLo $DOCKER_USER_HOME/.vim/spell/en.utf-8.spl \
128-
--create-dirs https://ftp.nluug.nl/pub/vim/runtime/spell/en.utf-8.spl
129-
RUN curl -fLo $DOCKER_USER_HOME/.vim/spell/en.utf-8.sug \
130-
--create-dirs https://ftp.nluug.nl/pub/vim/runtime/spell/en.utf-8.sug
131-
RUN curl -fLo $DOCKER_USER_HOME/.vim/spell/ru.utf-8.spl \
132-
--create-dirs https://ftp.nluug.nl/pub/vim/runtime/spell/ru.utf-8.spl
133-
RUN curl -fLo $DOCKER_USER_HOME/.vim/spell/ru.utf-8.sug \
134-
--create-dirs https://ftp.nluug.nl/pub/vim/runtime/spell/ru.utf-8.sug
135132
COPY --chown=$DOCKER_USER:$DOCKER_USER .vimrc $DOCKER_USER_HOME/.vimrc
136133
RUN cat $DOCKER_USER_HOME/.vimrc \
137134
|sed -n '/plug#begin/,/plug#end/p' > $DOCKER_USER_HOME/.vimrc_plug

README.md

Lines changed: 98 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [4. Start developing inside the container](#4-start-developing-inside-the-container)
1717
* [5. Update dependencies when needed](#5-update-dependencies-when-needed)
1818
* [Build and run your application](#build-and-run-your-application)
19+
* [Optional: Use `dev` for checks and experiments](#optional-use-dev-for-checks-and-experiments)
1920
* [Optional: Run Codex or Gemini (see more examples below)](#optional-run-codex-or-gemini-see-more-examples-below)
2021
* [Optional: Run JupyterLab](#optional-run-jupyterlab)
2122
* [💻 AI-Powered CLI Workflow (Gemini & Codex)](#-ai-powered-cli-workflow-gemini--codex)
@@ -67,19 +68,22 @@ Use it as-is or tailor it to match your team's development workflow.
6768

6869
## Tested with
6970

70-
* **Docker**: `27.3.1``29.1.1`
71-
* **buildx**: `0.20.0``0.30.0`
72-
* **Compose**: `2.32.1``2.40.3`
71+
* **Docker**: `27.3.1``29.2.1`
72+
* **buildx**: `0.20.0``0.31.1`
73+
* **Compose**: `2.32.1``5.0.2`
7374

7475
## Prerequisites
7576

76-
* Docker + Docker Compose v2 (and `docker buildx`)
77+
* Docker Engine with `docker compose` v2.0+ (minimum). Tested versions are
78+
listed above.
79+
* `docker buildx` is required only for cross-platform builds (when
80+
`DOCKER_PLATFORM` differs from your host). For native builds, it’s optional.
7781
* A supported `DOCKER_PLATFORM` for your machine (for example, Apple Silicon
7882
users often set `DOCKER_PLATFORM=linux/arm64`)
79-
* Note: the `codex-web-login` service uses `network_mode: host` (works on
80-
Linux; Docker Desktop users may need an alternative login flow). If needed,
81-
authenticate on the host (outside Docker) and use `OPENAI_API_KEY` /
82-
`GEMINI_API_KEY` inside the containers.
83+
* Note: the `codex-web-login` service uses `network_mode: host`. This works on
84+
Linux, and on macOS with recent Docker Desktop or OrbStack. If it doesn’t
85+
work in your setup, authenticate on the host (outside Docker) and use
86+
`OPENAI_API_KEY` / `GEMINI_API_KEY` inside the containers.
8387

8488
## Quickstart
8589

@@ -91,13 +95,38 @@ docker compose run --rm vim-ide
9195

9296
To exit Vim: `:q` (or `:qa` to quit all).
9397

98+
If you just want a shell in the dev environment:
99+
100+
```bash
101+
docker compose build dev
102+
docker compose run --rm dev
103+
```
104+
94105
## 🚀 Getting Started
95106

96107
### 1. Configure environment and Python settings and API tokens
97108

98-
Set OS packages, `DOCKER_PLATFORM` (if not linux/amd64), a `PYTHON_VERSION`
99-
available via `pyenv`, Poetry version, etc., and your API keys for
100-
`OPENAI_API_KEY` and `GEMINI_API_KEY`.
109+
Set the `.env` values used by `compose.yaml` and the Docker build. Common ones:
110+
111+
* `TZ` — Container timezone (e.g. `Europe/Berlin`, `Asia/Vladivostok`).
112+
* `DOCKER_PLATFORM` — Target architecture (e.g. `linux/amd64`, `linux/arm64`).
113+
* `DOCKER_HOST_UID` / `DOCKER_HOST_GID` — Host user/group IDs for file ownership.
114+
* `DOCKER_USER` / `DOCKER_USER_HOME` — Container user + home directory.
115+
* `MIRROR_LIST_COUNTRY` — Arch mirror country code for pacman.
116+
* `BUILD_PACKAGES` — System packages needed to build Python and runtime deps.
117+
* `VIM_PACKAGES` — Extra tools installed in the dev/vim images.
118+
* `PYTHON_VERSION` — Python version installed via pyenv.
119+
* `POETRY_VERSION` — Poetry version installed in the image.
120+
* `POETRY_OPTIONS_APP` — Poetry install flags for the app image.
121+
* `POETRY_OPTIONS_DEV` — Poetry install flags for the dev image.
122+
* `PIP_DEFAULT_TIMEOUT` — Pip network timeout (seconds).
123+
* `JUPYTER_TOKEN` — Token for JupyterLab login.
124+
* `OPENAI_API_KEY` — API key for Codex.
125+
* `GEMINI_API_KEY` — API key for Gemini.
126+
127+
Set `DOCKER_HOST_UID` / `DOCKER_HOST_GID` to match your host user so files
128+
created in the container are editable on the host. On Unix-like systems, use
129+
`id -u` and `id -g` to get the correct values.
101130

102131
```bash
103132
cp .env.dist .env
@@ -150,15 +179,46 @@ docker compose build app
150179
docker compose run --rm app
151180
```
152181

153-
> ℹ️ `vim-ide`, `poetry`, `codex`, `gemini`, and `jupyterlab` bind-mount your
154-
> working directory into the container for live editing. `app` is a “packaged”
155-
> image (it copies your sources), so code changes require rebuilding `app`.
182+
> ℹ️ `vim-ide`, `poetry`, `codex`, `gemini`, `jupyterlab`, and `dev` bind-mount
183+
> your working directory into the container for live editing. `app` is a
184+
> “packaged” image (it copies your sources), so code changes require rebuilding
185+
> `app`.
186+
187+
### Optional: Use `dev` for checks and experiments
188+
189+
`dev` is a general-purpose image for running tools, scripts, and ad-hoc checks
190+
inside the same environment as your Vim IDE.
191+
192+
`dev` and `vim-ide` are built from the same base stage, so they share the same
193+
tooling and system packages.
194+
195+
```bash
196+
docker compose build dev
197+
docker compose run --rm dev
198+
```
199+
200+
Examples:
201+
202+
```bash
203+
docker compose run --rm dev ruff check
204+
docker compose run --rm dev ruff format --check
205+
```
206+
207+
If you’re running as the non-root user and want to try extra system packages
208+
before baking them into the image, use `sudo`:
209+
210+
```bash
211+
docker compose run --rm dev sudo pacman -S --noconfirm <package>
212+
```
156213

157214
### Optional: Run Codex or Gemini (see more examples below)
158215

159216
> 🔄 Note: `codex` and `gemini` CLIs are installed during the image build via
160217
> Arch packages (`openai-codex`, `gemini-cli`) configured in `VIM_PACKAGES`
161218
> inside `.env`.
219+
>
220+
> `vim-ide` does not carry API keys or auth volumes, so run Codex/Gemini in a
221+
> separate terminal via their own services.
162222
163223
```bash
164224
docker compose build codex
@@ -182,9 +242,10 @@ docker compose run --rm --service-ports jupyterlab
182242

183243
This project template is designed to be easily integrated with powerful CLI
184244
tools like Gemini and Codex, enhancing your development workflow with
185-
intelligent assistance. Rather than replacing your editor, these tools
186-
complement Vim by running alongside it in a terminal—either inside or outside
187-
Vim—so you can inspect, generate, and reason about code without breaking flow.
245+
intelligent assistance. Rather than replacing your editor, these tools
246+
complement Vim by running alongside it in a separate terminal (via
247+
`docker compose run`) so you can inspect, generate, and reason about code
248+
without breaking flow.
188249

189250
NOTE: To use AI CLI tools such as Gemini or Codex, you must configure API keys
190251
according to each provider’s official documentation.
@@ -195,14 +256,15 @@ API keys for Codex and Gemini require separate billing. In some cases, you can
195256
use an OpenAI subscription (for example, ChatGPT Pro) or take advantage of the
196257
available limits of a personal Google account.
197258

198-
This type of access requires authentication via a browser. For OpenAI, run the
199-
command:
259+
This type of access requires authentication via a browser. Run these from a
260+
separate terminal via the `codex` / `gemini` services (not `vim-ide`). For
261+
OpenAI, run the command:
200262

201263
```bash
202264
docker compose run --rm codex-web-login
203265
```
204266

205-
For Gemini, there is no separate command — just run Gemini like
267+
For Gemini, there is no separate login command — just run:
206268

207269
```bash
208270
docker compose run --rm gemini
@@ -218,28 +280,23 @@ without any additional authentication steps.
218280

219281
### Where to run commands
220282

221-
You can run the CLIs either:
283+
Run the CLIs in their own containers (recommended):
222284

223-
**Inside the container** (recommended): `docker compose run --rm vim-ide`, then
224-
open a Vim terminal (`:terminal`) and run `codex` / `gemini`.
285+
```bash
286+
docker compose run --rm codex
287+
docker compose run --rm gemini
288+
```
225289

226-
**Outside Vim but still in Docker**: `docker compose run --rm codex` or `docker
227-
compose run --rm gemini`. See the `codex` and `gemini` services in
228-
`compose.yaml`.
290+
`vim-ide` is for editing only; it does not mount the auth volumes or API keys.
229291

230292
### Gemini CLI examples
231293

232294
The Gemini CLI provides a conversational interface to interact with your
233295
codebase, allowing you to ask questions, refactor code, fix bugs, and add new
234296
features.
235297

236-
Run interactively in Vim:
237-
238-
```bash
239-
gemini
240-
```
241-
242-
or using docker compose:
298+
Run all Gemini commands via Docker Compose so auth volumes and API keys are
299+
available:
243300

244301
```bash
245302
docker compose run --rm gemini
@@ -248,19 +305,19 @@ docker compose run --rm gemini
248305
Read a file:
249306

250307
```bash
251-
gemini read src/sample/main.py
308+
docker compose run --rm gemini read src/sample/main.py
252309
```
253310

254311
List directory contents:
255312

256313
```bash
257-
gemini list src/sample
314+
docker compose run --rm gemini list src/sample
258315
```
259316

260317
Explain a code snippet (hypothetical):
261318

262319
```bash
263-
gemini explain "def my_function():" --file src/sample/main.py
320+
docker compose run --rm gemini explain "def my_function():" --file src/sample/main.py
264321
```
265322

266323
### Codex CLI examples
@@ -269,13 +326,8 @@ The Codex CLI (or similar code generation/analysis tools) can be used for
269326
automating code generation, understanding project structure, and suggesting
270327
improvements.
271328

272-
Run interactively in Vim:
273-
274-
```bash
275-
codex
276-
```
277-
278-
or using docker compose:
329+
Run all Codex commands via Docker Compose so auth volumes and API keys are
330+
available:
279331

280332
```bash
281333
docker compose run --rm codex
@@ -284,19 +336,19 @@ docker compose run --rm codex
284336
Generate a new Python class (hypothetical):
285337

286338
```bash
287-
codex generate class User --fields name:str,email:str --language python --file src/models.py
339+
docker compose run --rm codex generate class User --fields name:str,email:str --language python --file src/models.py
288340
```
289341

290342
Analyze dependencies (hypothetical):
291343

292344
```bash
293-
codex analyze dependencies --project-root .
345+
docker compose run --rm codex analyze dependencies --project-root .
294346
```
295347

296348
Suggest tests for a file (hypothetical):
297349

298350
```bash
299-
codex suggest tests --file src/sample/main.py
351+
docker compose run --rm codex suggest tests --file src/sample/main.py
300352
```
301353

302354
## 🔒 Security notes

0 commit comments

Comments
 (0)