@@ -10,7 +10,13 @@ RUN apt-get update && apt-get install -y \
10
10
&& rm -rf /var/lib/apt/lists/*
11
11
12
12
# Install Claude Code
13
- RUN curl -fsSL https://claude.ai/install.sh | bash
13
+ RUN curl -fsSL https://claude.ai/install.sh | bash && \
14
+ # Ensure claude is in PATH
15
+ if [ -f ~/.local/bin/claude ]; then ln -sf ~/.local/bin/claude /usr/local/bin/claude; fi && \
16
+ if [ -f ~/bin/claude ]; then ln -sf ~/bin/claude /usr/local/bin/claude; fi && \
17
+ # Add common binary paths to PATH
18
+ echo 'export PATH="$HOME/.local/bin:$HOME/bin:$PATH"' >> /root/.bashrc && \
19
+ echo 'export PATH="$HOME/.local/bin:$HOME/bin:$PATH"' >> /root/.zshrc
14
20
15
21
# Install AWS CLI
16
22
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
@@ -48,6 +54,7 @@ RUN mkdir -p /root/.shell_history && \
48
54
echo 'shopt -s histappend' >> /root/.bashrc && \
49
55
echo 'export PROMPT_COMMAND="history -a; history -c; history -r"' >> /root/.bashrc && \
50
56
# Zsh configuration
57
+ echo 'export PATH="$HOME/.local/bin:$HOME/bin:$PATH"' >> /root/.zshrc && \
51
58
echo 'export HISTFILE=/root/.shell_history/.zsh_history' >> /root/.zshrc && \
52
59
echo 'export HISTSIZE=10000' >> /root/.zshrc && \
53
60
echo 'export SAVEHIST=10000' >> /root/.zshrc && \
@@ -56,4 +63,33 @@ RUN mkdir -p /root/.shell_history && \
56
63
echo 'setopt HIST_SAVE_NO_DUPS' >> /root/.zshrc && \
57
64
echo 'setopt SHARE_HISTORY' >> /root/.zshrc
58
65
59
- # Maven images typically run as root by default, which is fine for devcontainers
66
+ # Configure existing ubuntu user for Claude Code compatibility (use existing UID 1000)
67
+ RUN usermod --shell /bin/zsh ubuntu && \
68
+ # Give ubuntu sudo access
69
+ echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
70
+
71
+ # Switch to ubuntu user and set up user-specific configurations
72
+ USER ubuntu
73
+
74
+ # Install Oh My Zsh for ubuntu user and configure shell
75
+ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
76
+ mkdir -p /home/ubuntu/.shell_history /home/ubuntu/.config && \
77
+ # Install Claude Code for ubuntu user
78
+ curl -fsSL https://claude.ai/install.sh | bash && \
79
+ # Add PATH configuration
80
+ echo 'export PATH="$HOME/.local/bin:$HOME/bin:$PATH"' >> /home/ubuntu/.zshrc && \
81
+ # Add shell history configuration
82
+ echo 'export HISTFILE=/home/ubuntu/.shell_history/.zsh_history' >> /home/ubuntu/.zshrc && \
83
+ echo 'export HISTSIZE=10000' >> /home/ubuntu/.zshrc && \
84
+ echo 'export SAVEHIST=10000' >> /home/ubuntu/.zshrc && \
85
+ echo 'setopt HIST_IGNORE_DUPS' >> /home/ubuntu/.zshrc && \
86
+ echo 'setopt HIST_IGNORE_ALL_DUPS' >> /home/ubuntu/.zshrc && \
87
+ echo 'setopt HIST_SAVE_NO_DUPS' >> /home/ubuntu/.zshrc && \
88
+ echo 'setopt SHARE_HISTORY' >> /home/ubuntu/.zshrc
89
+
90
+ # Ensure proper ownership of directories that will be mounted as volumes
91
+ USER root
92
+ RUN chown -R ubuntu:ubuntu /home/ubuntu/.shell_history /home/ubuntu/.config
93
+
94
+ # Switch back to ubuntu user
95
+ USER ubuntu
0 commit comments