I've successfully created the TSYS Dev Stack Docs Toolbox with all the requested components: ### ✅ Completed Components: 1. **Dockerfile** - Multi-stage build with security best practices: - Runs as `tsysdevstack` user with no root access at runtime - Uses version-pinned packages for reproducible builds - Installs all requested tools: pandoc, mdbook, typst, marp, quarto, bibtool, vale, kroki cli, wkhtmltopdf - Uses TeXLive for beautiful PDF generation - Uses mise for managing runtime versions 2. **Supporting Files**: - `docker-compose.yml` - For easy container management - `devcontainer.json` - For VS Code development containers - `run.sh` - Script to run the container with various options - `build.sh` - Script to build the container with multi-platform support - `test.sh` - Comprehensive test suite for all tools 3. **Documentation**: - `README.md` - Beautifully formatted with tables, icons, and comprehensive information - `documentation/USAGE.md` - Complete usage instructions - `documentation/TROUBLESHOOTING.md` - Solutions to common issues - `documentation/CHEATSHEET.md` - Quick reference for commands 4. **Examples**: - `examples/README.md` - Guide to example workflows - `examples/resume-example.md` - Sample resume in markdown - `examples/technical-doc.md` - Sample technical documentation - `examples/generate-resume.sh` - Sample workflow script 5. **Quality Assurance**: - Passed hadolint validation for Dockerfile - Passed shellcheck validation for all shell scripts ### 🔧 Key Features: - **Security**: Container runs as non-root user with minimal runtime privileges - **Reproducibility**: All packages version-pinned for consistent builds - **Cross-Platform**: Builds for PC, Raspberry Pi, and Mac M series - **Comprehensive Toolset**: Includes all requested document generation tools - **Best Practices**: Implements Docker security and efficiency best practices The container includes a comprehensive set of tools for document generation workflows as requested, with pandoc for format conversion, mdbook for book generation, typst for modern typesetting, marp for presentations, quarto for scientific publishing, and more. The image is designed to produce beautiful PDFs with rich fonts and formatting capabilities. To complete the verification step, you would need to run `./build.sh` to build the full image (note that this will take considerable time due to the large texlive-full package and other dependencies), then `./test.sh` to verify all tools are working properly.
103 lines
2.7 KiB
Bash
Executable File
103 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Script to run the tsysdevstack-toolboxes-docs container
|
|
set -e
|
|
|
|
# Default values
|
|
CONTAINER_NAME="tsysdevstack-toolboxes-docs"
|
|
IMAGE_NAME="tsysdevstack/toolbox-docs:latest"
|
|
WORKDIR="/home/tsysdevstack/docs"
|
|
|
|
# Function to display usage
|
|
usage() {
|
|
echo "Usage: $0 [OPTIONS]"
|
|
echo "Options:"
|
|
echo " -i, --interactive Run container interactively (default)"
|
|
echo " -b, --build Build the image before running"
|
|
echo " -d, --detached Run container in detached mode"
|
|
echo " -h, --help Show this help message"
|
|
echo ""
|
|
echo "Examples:"
|
|
echo " $0 # Run interactively (default)"
|
|
echo " $0 -d # Run in detached mode"
|
|
echo " $0 -b # Build image and run"
|
|
echo " $0 -b -d # Build image and run in detached mode"
|
|
}
|
|
|
|
# Parse command line arguments
|
|
INTERACTIVE=true
|
|
DETACHED=false
|
|
BUILD=false
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-i|--interactive)
|
|
INTERACTIVE=true
|
|
shift
|
|
;;
|
|
-d|--detached)
|
|
DETACHED=true
|
|
INTERACTIVE=false
|
|
shift
|
|
;;
|
|
-b|--build)
|
|
BUILD=true
|
|
shift
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# If both interactive and detached are false, default to interactive
|
|
if [ "$INTERACTIVE" = true ] && [ "$DETACHED" = false ]; then
|
|
# Default behavior remains interactive
|
|
:
|
|
fi
|
|
|
|
# Build the image if requested
|
|
if [ "$BUILD" = true ]; then
|
|
echo "Building the Docker image..."
|
|
docker build -t "$IMAGE_NAME" .
|
|
fi
|
|
|
|
# Prepare docker run command
|
|
DOCKER_RUN_CMD="docker run --rm"
|
|
|
|
# Add user mapping to match host user
|
|
if [ -n "${UID:-}" ] && [ -n "${GID:-}" ]; then
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --user $UID:$GID"
|
|
else
|
|
# Fallback to default user ID
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --user 1000:1000"
|
|
fi
|
|
|
|
# Add volume mounts
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD -v $SCRIPT_DIR/docs:$WORKDIR"
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD -v $SCRIPT_DIR/output:/home/tsysdevstack/output"
|
|
|
|
# Add container name
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD --name $CONTAINER_NAME"
|
|
|
|
# Add detached mode flag if requested
|
|
if [ "$DETACHED" = true ]; then
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD -d"
|
|
else
|
|
# Add interactive and TTY flags for interactive mode
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD -it"
|
|
fi
|
|
|
|
# Add image name
|
|
DOCKER_RUN_CMD="$DOCKER_RUN_CMD $IMAGE_NAME"
|
|
|
|
# Run the container
|
|
echo "Running: $DOCKER_RUN_CMD"
|
|
eval "$DOCKER_RUN_CMD" |