Skip to content

Commit f3ecb99

Browse files
committed
Enhance devcontainer with zsh, Oh My Zsh, GitHub CLI, and improved shell experience
- Add zsh with Oh My Zsh for colorful terminal experience matching host - Install GitHub CLI with GH_TOKEN environment variable support - Configure persistent shell history for both bash and zsh (10k commands) - Add volume mounts for shell history, Claude auth, and GitHub CLI auth - Move docker-compose.yml to project root following standard conventions - Fix workspace folder mapping for proper git repository access - Enhanced bash/zsh configuration with history deduplication and sharing
1 parent c571882 commit f3ecb99

File tree

4 files changed

+70
-31
lines changed

4 files changed

+70
-31
lines changed

.devcontainer/Dockerfile

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Use official Maven image with Eclipse Temurin Java 25
22
FROM maven:3.9.11-eclipse-temurin-25
33

4-
# Install unzip and other tools needed
4+
# Install unzip, zsh and other tools needed
55
RUN apt-get update && apt-get install -y \
66
unzip \
7+
zsh \
8+
git \
79
&& apt-get clean \
810
&& rm -rf /var/lib/apt/lists/*
911

@@ -16,4 +18,42 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2
1618
&& ./aws/install \
1719
&& rm -rf awscliv2.zip aws
1820

21+
# Install GitHub CLI using direct binary download to avoid repository issues
22+
RUN ARCH=$(uname -m) && \
23+
if [ "$ARCH" = "x86_64" ]; then \
24+
GH_ARCH="linux_amd64"; \
25+
elif [ "$ARCH" = "aarch64" ]; then \
26+
GH_ARCH="linux_arm64"; \
27+
else \
28+
echo "Unsupported architecture: $ARCH" && exit 1; \
29+
fi && \
30+
GH_VERSION=$(curl -s https://api.github.com/repos/cli/cli/releases/latest | grep 'tag_name' | cut -d'"' -f4 | cut -c2-) && \
31+
curl -L "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_${GH_ARCH}.tar.gz" -o gh.tar.gz && \
32+
tar -xzf gh.tar.gz && \
33+
mv "gh_${GH_VERSION}_${GH_ARCH}/bin/gh" /usr/local/bin/gh && \
34+
chmod +x /usr/local/bin/gh && \
35+
rm -rf gh.tar.gz "gh_${GH_VERSION}_${GH_ARCH}"
36+
37+
# Install Oh My Zsh and configure zsh as default shell
38+
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
39+
chsh -s $(which zsh) root
40+
41+
# Set up shell history persistence for both bash and zsh
42+
RUN mkdir -p /root/.shell_history && \
43+
# Bash configuration
44+
echo 'export HISTFILE=/root/.shell_history/.bash_history' >> /root/.bashrc && \
45+
echo 'export HISTSIZE=10000' >> /root/.bashrc && \
46+
echo 'export HISTFILESIZE=10000' >> /root/.bashrc && \
47+
echo 'export HISTCONTROL=ignoredups:erasedups' >> /root/.bashrc && \
48+
echo 'shopt -s histappend' >> /root/.bashrc && \
49+
echo 'export PROMPT_COMMAND="history -a; history -c; history -r"' >> /root/.bashrc && \
50+
# Zsh configuration
51+
echo 'export HISTFILE=/root/.shell_history/.zsh_history' >> /root/.zshrc && \
52+
echo 'export HISTSIZE=10000' >> /root/.zshrc && \
53+
echo 'export SAVEHIST=10000' >> /root/.zshrc && \
54+
echo 'setopt HIST_IGNORE_DUPS' >> /root/.zshrc && \
55+
echo 'setopt HIST_IGNORE_ALL_DUPS' >> /root/.zshrc && \
56+
echo 'setopt HIST_SAVE_NO_DUPS' >> /root/.zshrc && \
57+
echo 'setopt SHARE_HISTORY' >> /root/.zshrc
58+
1959
# Maven images typically run as root by default, which is fine for devcontainers

.devcontainer/devcontainer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
22
"name": "DynamoDB Toolkit Dev Environment",
3-
"dockerComposeFile": "docker-compose.yml",
3+
"dockerComposeFile": "../docker-compose.yml",
44
"service": "devcontainer",
55
"workspaceFolder": "/workspace",
6+
"containerEnv": {
7+
"GH_TOKEN": "${localEnv:GH_TOKEN}"
8+
},
69
"customizations": {
710
"vscode": {
811
"extensions": [

.devcontainer/docker-compose.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker-compose.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
version: '3.8'
22

33
services:
4+
devcontainer:
5+
build:
6+
context: .devcontainer
7+
dockerfile: Dockerfile
8+
volumes:
9+
- .:/workspace:cached
10+
- devcontainer-shell-history:/root/.shell_history
11+
- claude-auth:/root/.config/claude
12+
- github-cli-auth:/root/.config/gh
13+
working_dir: /workspace
14+
command: sleep infinity
15+
depends_on:
16+
- dynamodb-local
17+
environment:
18+
AWS_ACCESS_KEY_ID: dummy
19+
AWS_SECRET_ACCESS_KEY: dummy
20+
AWS_DEFAULT_REGION: us-east-1
21+
DYNAMODB_ENDPOINT: http://dynamodb-local:8000
22+
423
dynamodb-local:
524
image: amazon/dynamodb-local:latest
625
command: ["-jar", "DynamoDBLocal.jar", "-sharedDb", "-inMemory"]
726
ports:
8-
- "8000:8000"
9-
environment:
10-
- AWS_ACCESS_KEY_ID=dummy
11-
- AWS_SECRET_ACCESS_KEY=dummy
12-
- AWS_DEFAULT_REGION=us-east-1
27+
- "8083:8000"
28+
29+
volumes:
30+
devcontainer-shell-history:
31+
claude-auth:
32+
github-cli-auth:

0 commit comments

Comments
 (0)