aboutsummaryrefslogtreecommitdiffstats
path: root/images/archlinux/Dockerfile
blob: 8367a0c1bb165ffd5ffdad460c48ea2f9d7b87cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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"]