entrypoint
Generates entrypoint.sh script for Docker container runtime environment variable injection. Replaces placeholder values in built assets with actual environment variables at container startup.
When & Why to Use This Skill
This Claude skill automates the generation of 'entrypoint.sh' scripts for Docker containers, specifically designed to handle runtime environment variable injection. It enables the 'build once, run anywhere' strategy by using envsubst to dynamically replace placeholders in compiled static assets (like JavaScript bundles) with actual environment variables at the moment the container starts.
Use Cases
- Dynamic Frontend Configuration: Injecting backend API URLs, environment names, or third-party API keys into minified React, Vue, or Angular production builds at runtime without needing to rebuild the Docker image.
- Multi-Environment Deployment: Using a single Docker image across Development, Staging, and Production environments by passing different environment variables that are automatically applied to the application files during startup.
- Nginx Container Orchestration: Streamlining the deployment of containerized web servers by automating the replacement of variables in static files and ensuring Nginx starts correctly in the foreground for container persistence.
| name | entrypoint |
|---|---|
| description | Generates entrypoint.sh script for Docker container runtime environment variable injection. Replaces placeholder values in built assets with actual environment variables at container startup. |
Entrypoint Script Skill
Purpose
Generate entrypoint.sh script for Docker container runtime environment variable injection.
Output
Create the file: entrypoint.sh
Example File
See: examples.md in this directory for complete examples and detailed explanations.
Notes
- Enables runtime environment variable injection into built JavaScript files
- Uses
envsubstto replace placeholders with actual environment variable values - Processes all app*.js files in nginx html directory
- Sets errexit and nounset for safer script execution
- Starts nginx in foreground mode for Docker container
- Requires gettext-base package for envsubst command
- Must be executable (chmod +x entrypoint.sh)