This directory contains Docker configuration files for deploying the Command Builder application.
The Command Builder is a static Angular application served via nginx. It can be run in a Docker container with custom command configurations mounted from the host system.
- Dockerfile: Multi-stage build configuration for creating the application image
- docker-compose.yml: Compose configuration for easy deployment
- README.md: This file
- Docker Engine 20.10 or later
- Docker Compose V2 (optional, for using docker-compose.yml)
docker run -d \
--name command-builder \
-p 8080:80 \
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
ghcr.io/danielraab/command-builder:latestensure that the commands.json file exists. remove the mount if you want use the commands.json from the repository (https://github.com/danielraab/command-builder/blob/master/public/commands.json).
If you have a custom commands.json file in a different location:
docker run -d \
--name command-builder \
-p 8080:80 \
-v /path/to/your/commands.json:/usr/share/nginx/html/commands.json:ro \
ghcr.io/danielraab/command-builder:latest-d: Run container in detached mode (background)--name command-builder: Assign a name to the container-p 8080:80: Map port 80 from container to host port 8080-v: Mount the commands.json file (:romeans read-only)ghcr.io/danielraab/command-builder:latest: The image to use
From the docker directory:
docker-compose up -dTo stop the application:
docker-compose downTo view logs:
docker-compose logs -fThe commands.json file is mounted as a read-only volume from the host system. This allows you to:
- Customize available commands without rebuilding the image
- Share command configurations across multiple deployments
- Update commands by simply restarting the container
Mount Path: /usr/share/nginx/html/commands.json
No environment variables are required for the static application. The nginx server runs on port 80 by default.
By default, nginx serves on port 80. To use a different port on the host:
docker run -d \
--name command-builder \
-p 3000:80 \
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
ghcr.io/danielraab/command-builder:latestThen access the application at http://localhost:3000
Once the container is running, open your browser and navigate to:
http://localhost:8080
The Dockerfile uses a multi-stage build process:
- Builder Stage: Compiles the Angular application with all dev dependencies
- Production Stage: Serves static files using nginx:alpine
This approach results in a smaller, more secure final image optimized for serving static content.
The final image is based on nginx:alpine, providing a minimal footprint optimized for serving static files.
If you see an error like:
docker: Error response from daemon: failed to create task for container: OCI runtime create failed:
unable to start container process: error mounting "/path/to/commands.json" to rootfs: not a directory
Cause: Docker requires that the source file exists on the host before mounting. If the file doesn't exist, Docker creates a directory instead, causing the mount to fail.
Solution: Ensure the public/commands.json file exists before starting the container:
# From the project root
ls -la public/commands.json
# If the file doesn't exist, copy it from the repository
# Or create it with proper contentWhen running from a different directory, use absolute paths:
docker run -d \
--name command-builder \
-p 8080:80 \
-v /absolute/path/to/public/commands.json:/usr/share/nginx/html/commands.json:ro \
ghcr.io/danielraab/command-builder:latestCheck the logs:
docker logs command-builderChange the host port mapping:
docker run -d \
--name command-builder \
-p 8081:80 \
-v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \
ghcr.io/danielraab/command-builder:latestVerify the volume mount path is correct:
docker inspect command-builder | grep -A 5 MountsEnsure commands.json exists and is readable:
ls -la public/commands.jsonAfter modifying commands.json, restart the container:
docker restart command-builderOr with docker-compose:
docker-compose restart- Use specific version tags instead of
latestfor reproducible deployments - Set resource limits to prevent resource exhaustion:
docker run -d \ --name command-builder \ --memory="256m" \ --cpus="0.5" \ -p 8080:80 \ -v $(pwd)/public/commands.json:/usr/share/nginx/html/commands.json:ro \ ghcr.io/danielraab/command-builder:latest
- Use a reverse proxy (nginx, Traefik) for SSL/TLS termination
- Enable health checks in production environments
- Back up your custom
commands.jsonfile regularly
# Build
docker build -f docker/Dockerfile -t ghcr.io/danielraab/command-builder:0.1.0 .
# Tag as latest
docker tag ghcr.io/danielraab/command-builder:0.1.0 ghcr.io/danielraab/command-builder:latest
# Login
echo $GITHUB_TOKEN | docker login ghcr.io -u danielraab --password-stdin
# Push
docker push ghcr.io/danielraab/command-builder:0.1.0
docker push ghcr.io/danielraab/command-builder:latest# Build
docker build -f docker/Dockerfile -t danielraab/command-builder:0.1.0 .
# Tag as latest
docker tag danielraab/command-builder:0.1.0 danielraab/command-builder:latest
# Push
docker push danielraab/command-builder:0.1.0
docker push danielraab/command-builder:latestThis Docker configuration is part of the Command Builder project and follows the same license.