This repository provides a minimal asset image (built FROM scratch) that bundles common entrypoint scripts. This image is not intended to be used directly as a base image, but rather to provide its scripts to other Docker images via multi-stage builds using COPY --from.
This approach centralizes common script logic, ensures versioning, and allows downstream images to choose their own base operating system while still benefiting from these shared utilities.
Instead of using FROM ghcr.io/coolcow/entrypoints, you should integrate these scripts into your application's Dockerfile using COPY --from.
Example Dockerfile for a downstream project:
# Stage 1: Fetch the entrypoint scripts from the asset image
FROM ghcr.io/coolcow/entrypoints:v1.1.0 AS entrypoints
# Stage 2: Your actual application image
FROM node:20-alpine # Or any other base image like alpine, ubuntu, python, etc.
# Copy the desired scripts from the asset stage
COPY --from=entrypoints /assets/ensure_user_group_home.sh /usr/local/bin/ensure_user_group_home.sh
COPY --from=entrypoints /assets/entrypoint_su-exec.sh /usr/local/bin/entrypoint_su-exec.sh
# Make the scripts executable
RUN chmod +x /usr/local/bin/ensure_user_group_home.sh \
/usr/local/bin/entrypoint_su-exec.sh
# Set the entrypoint for your application (e.g., using su-exec)
ENTRYPOINT ["entrypoint_su-exec.sh"]
# Your application-specific setup continues here...
# COPY package.json .
# RUN npm install
# COPY . .
# CMD ["npm", "start"]The coolcow/entrypoints asset image provides the following scripts, located in the /assets/ directory within the image:
-
/assets/ensure_user_group_home.sh: Creates/updates a user, group, and home directory using environment variables only.Variable Default Notes TARGET_UID1000Target user ID. TARGET_GID1000Target group ID. TARGET_REMAP_IDS1Set 0to disable remapping of conflicting UID/GID entries.TARGET_USERtargetTarget user name. TARGET_GROUPtargetTarget group name. TARGET_HOME/home/targetTarget home directory. TARGET_SHELL/bin/shSet empty to skip shell updates. -
/assets/entrypoint_su-exec.sh: Callsensure_user_group_home.shand executes a command asTARGET_USERviasu-exec. -
/assets/entrypoint_crond.sh: Callsensure_user_group_home.sh, installs a crontab forTARGET_USER, and runscrond.
This project uses GitHub Actions to build, test, and publish the asset image. For local development or debugging, you can run the tests manually:
- Build the asset image locally:
docker build -t ghcr.io/coolcow/entrypoints:local-test-build -f build/Dockerfile build
- Run the smoke tests:
docker build --build-arg APP_IMAGE=ghcr.io/coolcow/entrypoints:local-test-build -f build/Dockerfile.test build
- The
Dockerfile(build/Dockerfile) defines theFROM scratchasset image. - The
Dockerfile.test(build/Dockerfile.test) contains verification steps to ensure the scripts are correctly included and functional. - The
build-test-publish.ymlworkflow (.github/workflows/build-test-publish.yml) orchestrates the build, runs the tests, and pushes the final image toghcr.io.