Files
whp-default-container/CLAUDE.md
jknapp 03be2342d1
All checks were successful
WHP Default Container / Build-and-Push (push) Successful in 14s
Enable .htaccess support in Apache container
- Modified Dockerfile to set AllowOverride All for htdocs directory
- Enabled mod_rewrite module for common .htaccess functionality
- Added CLAUDE.md with project documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-23 19:08:06 -07:00

56 lines
1.9 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a Docker-based web server container that provides an Apache HTTP Server with an auto-detection mechanism for web content. If the web directory is empty on startup, it automatically copies a default landing page.
## Key Architecture
- **Container Base**: Apache HTTP Server on Alpine Linux (`httpd:alpine`)
- **Startup Logic**: `scripts/startup.sh` handles the auto-detection and default content copying
- **Default Content**: Professional landing page in root `index.html`
- **Web Root**: `/usr/local/apache2/htdocs` inside the container
## Common Commands
### Build and Run
```bash
# Build the container
docker build -t my-web-server .
# Run with default settings
docker run -p 80:80 my-web-server
# Run with volume mount for custom content
docker run -p 80:80 -v /path/to/web/content:/usr/local/apache2/htdocs my-web-server
# Run on custom port
docker run -p 8080:80 my-web-server
```
### Development
```bash
# View container logs
docker logs <container-id>
# Execute shell in running container
docker exec -it <container-id> /bin/sh
# Test startup script locally
chmod +x scripts/startup.sh
./scripts/startup.sh
```
## Server Deployment
- The git directory on the servers are /root/whp and once you do a git pull, to sync web files you would run the rsync command for web-files/ to /docker/whp/web/
## Important Implementation Details
1. **Auto-Detection Logic**: The startup script checks if `/usr/local/apache2/htdocs` is empty (ignoring hidden files) before copying default content
2. **Non-Destructive**: Only copies default content if the directory is truly empty - won't overwrite existing files
3. **Startup Flow**:
- Container starts → `startup.sh` runs → Checks for content → Copies if empty → Starts Apache
4. **Default Landing Page**: Responsive, professional design with proper meta tags and CSS