Compare commits
3 commits
main
...
fix/docker
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3493854649 | ||
|
|
b80cf97787 | ||
|
|
35338f3220 |
4 changed files with 105 additions and 2 deletions
|
|
@ -11,13 +11,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
g++ \
|
g++ \
|
||||||
chromium \
|
chromium \
|
||||||
gnupg \
|
gnupg \
|
||||||
docker.io \
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
ripgrep \
|
ripgrep \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
|
RUN curl -LsSf https://astral.sh/uv/install.sh | UV_INSTALL_DIR=/usr/local/bin sh
|
||||||
|
|
||||||
|
RUN mkdir -p -m 0755 /etc/apt/keyrings \
|
||||||
|
&& curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
|
||||||
|
&& chmod a+r /etc/apt/keyrings/docker.asc \
|
||||||
|
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian trixie stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends docker-ce-cli docker-compose-plugin \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN mkdir -p -m 0755 /etc/apt/keyrings \
|
RUN mkdir -p -m 0755 /etc/apt/keyrings \
|
||||||
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
||||||
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
- DOCKER_HOST=tcp://docker-dind:2375
|
- DOCKER_HOST=tcp://dind:2375
|
||||||
- OPENCODE_CONFIG_DIR=/root/.config/opencode
|
- OPENCODE_CONFIG_DIR=/root/.config/opencode
|
||||||
- OPENCODE_MEMORY_DIR=/root/.local/share/opencode/opencode-memory
|
- OPENCODE_MEMORY_DIR=/root/.local/share/opencode/opencode-memory
|
||||||
- DOCKER_CONTAINER=true
|
- DOCKER_CONTAINER=true
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,39 @@ def test_dind_limits_unchanged():
|
||||||
assert "pids: 512" in dind_block
|
assert "pids: 512" in dind_block
|
||||||
|
|
||||||
|
|
||||||
|
# ── DOCKER_HOST points to a resolvable name (issue #222 — fix unresolvable host)
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_host_uses_resolvable_name():
|
||||||
|
"""opencode ``DOCKER_HOST`` points to the dind service alias ``dind``.
|
||||||
|
|
||||||
|
The compose service is named ``dind`` (``container_name:
|
||||||
|
opencode-docker-dind``). DNS inside the ``opencode_network`` resolves the
|
||||||
|
service name, so ``tcp://dind:2375`` works; the old ``tcp://docker-dind``
|
||||||
|
referenced no existing name and never resolved.
|
||||||
|
"""
|
||||||
|
content = _compose_text()
|
||||||
|
assert "DOCKER_HOST=tcp://dind:2375" in content, (
|
||||||
|
"docker-compose.yml opencode DOCKER_HOST must point to `tcp://dind:2375` "
|
||||||
|
"(compose service alias) — the old `docker-dind` name does not resolve "
|
||||||
|
"in opencode_network (issue #222)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_host_old_name_removed():
|
||||||
|
"""Raw text check: ``docker-dind`` hostname is absent from DOCKER_HOST.
|
||||||
|
|
||||||
|
The old ``tcp://docker-dind:2375`` referenced neither the compose service
|
||||||
|
name (``dind``) nor the container name (``opencode-docker-dind``) and
|
||||||
|
never resolved inside ``opencode_network``.
|
||||||
|
"""
|
||||||
|
content = _compose_text()
|
||||||
|
assert "DOCKER_HOST=tcp://docker-dind:2375" not in content, (
|
||||||
|
"docker-compose.yml must not retain the unresolvable `docker-dind` "
|
||||||
|
"hostname in DOCKER_HOST (issue #222)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,69 @@ def test_single_npm_install_line_has_kept_packages():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ── docker CLI install (issue #222 — docker-ce-cli + compose plugin) ─────────
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_io_removed_from_apt_install():
|
||||||
|
"""Dockerfile does NOT install the ``docker.io`` Debian metapackage.
|
||||||
|
|
||||||
|
The ``docker.io`` package on trixie ships ``dockerd`` + ``docker-proxy`` +
|
||||||
|
``docker-init`` but NOT the ``docker`` CLI binary. The opencode container
|
||||||
|
delegates to the external DinD service, so running a local daemon is dead
|
||||||
|
weight — only the CLI is needed. ``docker-ce-cli`` (official Docker APT
|
||||||
|
repo) provides ``/usr/bin/docker`` and matches DinD 29.6.2 (API 1.55).
|
||||||
|
"""
|
||||||
|
content = _dockerfile_text()
|
||||||
|
assert "docker.io" not in content, (
|
||||||
|
"Dockerfile must NOT install `docker.io` — trixie ships no `docker` "
|
||||||
|
"CLI binary, only the daemon; install `docker-ce-cli` instead (issue #222)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_ce_cli_installed():
|
||||||
|
"""Dockerfile installs ``docker-ce-cli`` from the official Docker APT repo.
|
||||||
|
|
||||||
|
Provides ``/usr/bin/docker`` and matches DinD 29.6.2 (API 1.55). The
|
||||||
|
Debian ``docker.io`` package does NOT ship the CLI on trixie.
|
||||||
|
"""
|
||||||
|
content = _dockerfile_text()
|
||||||
|
assert "docker-ce-cli" in content, (
|
||||||
|
"Dockerfile must install `docker-ce-cli` so `which docker` resolves to "
|
||||||
|
"/usr/bin/docker and `docker version` reaches the DinD server (issue #222)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_compose_plugin_installed():
|
||||||
|
"""Dockerfile installs ``docker-compose-plugin`` (Compose v2 subcommand).
|
||||||
|
|
||||||
|
The old Python ``docker-compose`` (v1) is NOT compatible. ``docker
|
||||||
|
compose`` (subcommand) requires the plugin, bundled with the official
|
||||||
|
Docker APT repo alongside ``docker-ce-cli``.
|
||||||
|
"""
|
||||||
|
content = _dockerfile_text()
|
||||||
|
assert "docker-compose-plugin" in content, (
|
||||||
|
"Dockerfile must install `docker-compose-plugin` so `docker compose "
|
||||||
|
"version` prints v2.x (issue #222)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_docker_apt_repo_added():
|
||||||
|
"""Dockerfile adds the official Docker APT repository (``download.docker.com``).
|
||||||
|
|
||||||
|
``docker-ce-cli`` / ``docker-compose-plugin`` are not in the Debian
|
||||||
|
trixie default repos — the official Docker repo is required to match the
|
||||||
|
DinD version (29.6.2, API 1.55).
|
||||||
|
"""
|
||||||
|
content = _dockerfile_text()
|
||||||
|
assert "download.docker.com/linux/debian" in content, (
|
||||||
|
"Dockerfile must add the official Docker APT repo (download.docker.com) "
|
||||||
|
"to install docker-ce-cli matching DinD 29.6.2 (issue #222)"
|
||||||
|
)
|
||||||
|
assert "triex" not in content.replace("trixie", ""), (
|
||||||
|
"Dockerfile Docker APT repo must target the trixie suite (matches base image)"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue