Okay, this is a comprehensive request! Here's a complete solution, including the Docker Compose file, Dockerfiles, Go server code, zsh configuration, file structure, and setup instructions. This is a substantial amount of code, so I'll break it down into sections.
1. File Tree Structure
web-automation-dev/
├── docker-compose.yml
├── go-server/
│ ├── Dockerfile
│ └── main.go
├── dev-container/
│ ├── Dockerfile
│ └── .zshrc
└── README.md
2. docker-compose.yml
version: "3.9"
services:
go-server:
build:
context: ./go-server
dockerfile: Dockerfile
ports:
- "8080:8080"
networks:
- app-network
dev-container:
build:
context: ./dev-container
dockerfile: Dockerfile
volumes:
- dev-data:/home/developer
ports:
- "3000:3000" # For Playwright inspector if needed
environment:
- DISPLAY=${DISPLAY} # For potential GUI access
stdin_open: true # Allow interactive shell
tty: true # Allocate a pseudo-TTY
networks:
- app-network
networks:
app-network:
driver: bridge
volumes:
dev-data:
3. go-server/Dockerfile
FROM golang:1.24-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o main .
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/main .
COPY static ./static
EXPOSE 8080
CMD ["./main"]
4. go-server/main.go (Chi example)
package main
import (
"fmt"
"log"
"net/http"
"os"
)
func main() {
r := NewRouter()
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
fmt.Printf("Server listening on port %s\n", port)
log.Fatal(http.ListenAndServe(":"+port, r))
}
func NewRouter() *chi.Mux {
r := chi.NewRouter()
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/index.html")
})
r.Get("/api/hello", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello from Go server!")
})
return r
}
5. go-server/static/index.html (Simple example)
<!DOCTYPE html>
<html>
<head>
<title>Go Server</title>
</head>
<body>
<h1>Hello from the Go Server!</h1>
<p>This is a static file served by the Go server.</p>
</body>
</html>
6. dev-container/Dockerfile
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 \
python3-pip \
nodejs \
npm \
git \
neovim \
curl \
jq \
htop \
tree \
wget \
zsh \
oh-my-zsh \
build-essential \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js dependencies
RUN npm install -g playwright
# Install Python dependencies
RUN pip3 install playwright
# Install axe-core for Playwright (Python)
RUN pip3 install axe-selenium
# Install zsh plugins
RUN git clone --depth 1 https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
RUN git clone --depth 1 https://github.com/romkatv/powerlevel10k.git ~/.powerlevel10k
RUN git clone --depth 1 https://github.com/zsh-users/zsh-autosuggestions ~/.zsh-autosuggestions
RUN git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting ~/.zsh-syntax-highlighting
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
RUN git clone --depth 1 https://github.com/wookietek/zsh-history-substring-search ~/.zsh-history-substring-search
RUN git clone --depth 1 https://github.com/lukesampson/zsh-colored-man-pages ~/.zsh-colored-man-pages
RUN git clone --depth 1 https://github.com/romkatv/eza.git ~/.eza
# Set up user
RUN useradd -m -s /bin/zsh developer
USER developer
WORKDIR /home/developer
# Copy zsh configuration
COPY .zshrc /home/developer/.zshrc
# Source zsh configuration
RUN echo "source /home/developer/.zshrc" >> /home/developer/.zshrc
# Install powerlevel10k
RUN echo 'source /home/developer/.powerlevel10k/powerlevel10k.zsh' >> /home/developer/.zshrc
# Install zsh plugins
RUN echo "source /home/developer/.zsh-autosuggestions/zsh-autosuggestions.zsh" >> /home/developer/.zshrc
RUN echo "source /home/developer/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> /home/developer/.zshrc
RUN echo "source /home/developer/.fzf/shell/key-bindings.zsh" >> /home/developer/.zshrc
RUN echo "source /home/developer/.zsh-history-substring-search/zsh-history-substring-search.zsh" >> /home/developer/.zshrc
RUN echo "source /home/developer/.zsh-colored-man-pages/zsh-colored-man-pages.zsh" >> /home/developer/.zshrc
RUN echo "source /home/developer/.eza/eza.zsh" >> /home/developer/.zshrc
# Install nvm
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> /home/developer/.zshrc
RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/developer/.zshrc
RUN echo 'export PATH=$NVM_DIR/versions/node/v22/bin:$PATH' >> /home/developer/.zshrc