# Arch Linux Base Image with systemd FROM archlinux:latest AS base LABEL maintainer="sinitax" LABEL description="Arch Linux with systemd" # Update system RUN pacman -Syu --noconfirm # Install sudo RUN pacman -S --noconfirm sudo # Create claude user with password and enable linger RUN useradd -m -s /bin/bash -G wheel claude && \ echo "claude:claude" | chpasswd && \ echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \ mkdir -p /var/lib/systemd/linger && \ touch /var/lib/systemd/linger/claude && \ chmod 644 /var/lib/systemd/linger/claude && \ mkdir -p /home/claude/.local/bin && \ chown -R claude:claude /home/claude # Enable systemd-networkd and systemd-resolved RUN systemctl enable systemd-networkd systemd-resolved # Configure eth0 with DHCP (IPv4 and IPv6) RUN printf '[Match]\nName=eth0\n\n[Network]\nDHCP=yes\nIPv6AcceptRA=yes\n' > /etc/systemd/network/20-eth0.network # Configure DNS via systemd-resolved RUN mkdir -p /etc/systemd/resolved.conf.d && \ printf '[Resolve]\nDNS=8.8.8.8 8.8.4.4 1.1.1.1\n' > /etc/systemd/resolved.conf.d/dns.conf # Set up resolv.conf symlink and hostname on boot (can't modify during Docker build) RUN printf 'L+ /etc/resolv.conf - - - - /run/systemd/resolve/stub-resolv.conf\nf /etc/hostname - - - - claude-vm\n' > /etc/tmpfiles.d/claude-vm.conf CMD ["/sbin/init"] # ============================================================================= # FULL STAGE - Complete development environment # ============================================================================= FROM base AS full LABEL description="Arch Linux development environment with common tools" # Install development tools and Docker RUN pacman -S --noconfirm \ base-devel \ git \ curl \ wget \ docker \ docker-compose \ && rm -rf /var/cache/pacman/pkg/* # Enable Docker service RUN systemctl enable docker # Add claude user to docker group RUN usermod -aG docker claude # Install claude-code as claude user ARG CLAUDE_INSTALL_CACHE_BUST=0 USER claude RUN curl -fsSL https://claude.ai/install.sh | bash && \ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc USER root # Set working directory WORKDIR /home/claude CMD ["/sbin/init"]