Files
computer-playbook/Dockerfile
T
kevinveenbirkenbachandClaude Opus 4.7 00c4246c3a refactor(env): introduce INFINITO_VENV_DIR SPOT, fix dev image build
Adds INFINITO_VENV_DIR=/opt/venvs/infinito to default.env (registered
in passthrough's STATIC_KEYS so make dotenv propagates it to .env) and
threads it through the build chain: compose.yml forwards it as a build
arg; scripts/image/push.sh asserts and --build-args it; the Dockerfile
declares the matching ARG/ENV and derives PYTHON/PIP/PATH from the
variable. scripts/meta/env/python.sh now prefers the value when set
before its fallback discovery so the SPOT is effective in env
resolution.

Fixes the dev image build regression where 'infinito --version' in
scripts/docker/entry.sh exited 127. Root cause: the Dockerfile RUN
SHELL uses bash -lc, which sources /etc/profile and resets PATH to
the Debian default, dropping ${INFINITO_VENV_DIR}/bin from it. The
fix invokes the script via its absolute path "${INFINITO_VENV_DIR}/bin/infinito"
so the post-install version check no longer depends on a PATH that
the login-shell init has just clobbered.

scripts/lint/wrapper.sh's existing PATH-reset note now references the
variable instead of the literal path. test-install-make.yml and
test-install-pkgmgr.yml read INFINITO_VENV_DIR from default.env up
front, pass it into their pkgmgr containers, and source the venv
activate script via the variable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 22:12:19 +02:00

80 lines
3.1 KiB
Docker

# syntax=docker/dockerfile:1
# Base image (pkgmgr) selector. SPOT lives in default.env's
# INFINITO_PARENT_IMAGE and is forwarded as a build arg by compose.yml /
# scripts/image/build.sh.
# Example values:
# INFINITO_PARENT_IMAGE=ghcr.io/kevinveenbirkenbach/pkgmgr-arch:stable
ARG INFINITO_PARENT_IMAGE
FROM ${INFINITO_PARENT_IMAGE} AS full
# Hadolint DL4006: ensure pipefail is set for RUN instructions that use pipes
SHELL ["/bin/bash", "-o", "pipefail", "-lc"]
# Forwardable build-time Nix settings (e.g., GitHub access tokens to avoid rate limits)
ARG NIX_CONFIG
# SPOT for the bind-mounted source tree inside the container. The compose
# stack forwards default.env's INFINITO_SRC_DIR as a build arg.
ARG INFINITO_SRC_DIR
ENV INFINITO_SRC_DIR=${INFINITO_SRC_DIR}
ARG INFINITO_VENV_DIR
ENV INFINITO_VENV_DIR=${INFINITO_VENV_DIR}
ENV PYTHON="${INFINITO_VENV_DIR}/bin/python"
ENV PIP="${INFINITO_VENV_DIR}/bin/python -m pip"
ENV PATH="${INFINITO_VENV_DIR}/bin:${PATH}"
# Make Nix non-interactive for flake config (CI-friendly)
RUN set -euo pipefail; \
cat /etc/os-release || true; \
if [ -f /etc/nix/nix.conf ]; then \
grep -q '^accept-flake-config *= *true' /etc/nix/nix.conf || \
echo 'accept-flake-config = true' >> /etc/nix/nix.conf; \
fi
# ------------------------------------------------------------
# Infinito.Nexus source in
# ------------------------------------------------------------
COPY . ${INFINITO_SRC_DIR}
# ------------------------------------------------------------
# Install Python 3.11+, Docker CLI, and distro package dependencies
# ------------------------------------------------------------
# hadolint ignore=DL3008,DL3033,DL3041
RUN set -euo pipefail; \
/bin/bash ${INFINITO_SRC_DIR}/roles/dev-python/files/install.sh; \
/bin/bash ${INFINITO_SRC_DIR}/roles/sys-svc-container/files/install-cli.sh; \
/bin/bash ${INFINITO_SRC_DIR}/scripts/install/package.sh
# ------------------------------------------------------------
# Disable interactive first-boot units (CI / container safe)
# ------------------------------------------------------------
RUN set -euo pipefail; \
systemctl mask systemd-firstboot.service first-boot-complete.target || true; \
systemd-machine-id-setup || true
# systemd-in-container conventions
ENV container=docker
STOPSIGNAL SIGRTMIN+3
RUN set -euo pipefail; \
export NIX_CONFIG="${NIX_CONFIG:-}"; \
"${INFINITO_SRC_DIR}/scripts/docker/entry.sh" --compile -- true
# Set workdir to / to avoid ambiguous commands
WORKDIR /
COPY scripts/docker/healthcheck.sh /usr/local/bin/healthcheck.sh
RUN chmod +x /usr/local/bin/healthcheck.sh
# Allow 20s because `infinito --help` can exceed 5s on fresh CI runners.
HEALTHCHECK --interval=5s --timeout=20s --start-period=30s --retries=20 \
CMD /usr/local/bin/healthcheck.sh
# JSON-form ENTRYPOINT does not expand ENV vars; wrap via bash -c so the
# INFINITO_SRC_DIR SPOT still controls the path. `exec` preserves systemd
# signal forwarding; `--` is the placeholder for $0.
ENTRYPOINT ["/bin/bash", "-c", "exec \"${INFINITO_SRC_DIR}/scripts/docker/entry.sh\" \"$@\"", "--"]
# IMPORTANT: default to systemd as PID 1
CMD ["/sbin/init"]