refactor(container): organize container files in proper directory structure

- Move Dockerfile to docker/quarto-build/
- Add docker/quarto-build/README.md with documentation
- Add docker/quarto-build/.dockerignore for build optimization
- Update workflow to use new Dockerfile path
- Update documentation to reflect new structure
- Improve organization and maintainability
This commit is contained in:
Vijay Janapa Reddi
2025-08-05 14:48:50 -04:00
parent 1ac52ece4d
commit 8a9fe3ade0
5 changed files with 156 additions and 3 deletions

View File

@@ -17,7 +17,7 @@ on:
push:
paths:
- 'tools/dependencies/**'
- 'Dockerfile'
- 'docker/quarto-build/**'
- '.github/workflows/build-container.yml'
env:
@@ -57,7 +57,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
file: ./docker/quarto-build/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -0,0 +1,71 @@
# Exclude unnecessary files from Docker build context
# This reduces build time and image size
# Build artifacts
build/
_book/
_site/
*.pdf
*.html
# Git and version control
.git/
.gitignore
# Documentation
docs/
*.md
!docker/quarto-build/README.md
# IDE and editor files
.vscode/
.idea/
*.swp
*.swo
*~
# OS files
.DS_Store
Thumbs.db
# Logs and temporary files
*.log
*.tmp
*.temp
# Node modules (if any)
node_modules/
# Python cache
__pycache__/
*.pyc
*.pyo
# R cache
.Rhistory
.RData
# Large media files (not needed for build)
assets/media/
*.mp4
*.avi
*.mov
# Test files
test-*
*.test.*
# Backup files
*.bak
*.backup
# Large data files
data/
*.csv
*.json
*.xml
# Keep only essential files for build
# - tools/dependencies/ (needed for package installation)
# - book/ (needed for build testing)
# - .github/workflows/ (needed for workflow files)

View File

@@ -0,0 +1,80 @@
# Quarto Build Container
This directory contains the Docker container configuration for the MLSysBook build system.
## Purpose
The container pre-installs all dependencies to eliminate the 30-45 minute setup time for Linux builds, reducing build times from 45 minutes to 5-10 minutes.
## Structure
```
docker/quarto-build/
├── Dockerfile # Container definition
├── README.md # This file
└── .dockerignore # Files to exclude from build
```
## Container Contents
- **Base**: Ubuntu 22.04
- **TeX Live**: Full distribution (texlive-full)
- **R**: R-base with all required packages
- **Python**: Python 3.13 with all requirements
- **Quarto**: Version 1.7.31
- **Tools**: Inkscape, Ghostscript, fonts
- **Dependencies**: All from `tools/dependencies/`
## Build Process
The container is built and tested via GitHub Actions:
```bash
# Trigger container build
gh workflow run build-container.yml
```
## Usage
The container is used in the containerized build workflow:
```yaml
container:
image: ghcr.io/harvard-edge/cs249r_book/quarto-build:latest
options: --user root
```
## Testing
The container build includes 17 comprehensive tests:
1. Quarto functionality
2. Python packages (all from requirements.txt)
3. R packages (all from install_packages.R)
4. TeX Live and LaTeX engines
5. Inkscape SVG to PDF conversion
6. Ghostscript PDF compression
7. Fonts and graphics libraries
8. Quarto render test
9. TikZ compilation test
10. System resources check
11. Network connectivity
12. Book structure compatibility
13. Quarto configuration files
14. Dependencies files accessibility
15. Quarto check (same as workflow)
16. Actual build process simulation
17. Memory and disk space verification
## Registry
- **Registry**: GitHub Container Registry (ghcr.io)
- **Image**: `ghcr.io/harvard-edge/cs249r_book/quarto-build`
- **Tags**: `latest`, `main`, `dev`, branch-specific tags
- **Size**: ~2-3GB (includes TeX Live, R, Python packages)
## Performance
- **Traditional build**: 45 minutes
- **Containerized build**: 5-10 minutes
- **Improvement**: 80-90% time reduction

View File

@@ -30,7 +30,9 @@ Containerized Linux Build (5-10 minutes):
## Files
### Core Files
- `Dockerfile` - Container definition with all dependencies
- `docker/quarto-build/Dockerfile` - Container definition with all dependencies
- `docker/quarto-build/README.md` - Container documentation
- `docker/quarto-build/.dockerignore` - Build exclusions
- `.github/workflows/build-container.yml` - Builds and pushes container
- `.github/workflows/quarto-build-container.yml` - Containerized build workflow