Sis repository contains Dockerfiles with additional modules (binaries, scripts, etc.) that can be reused in other Docker images.
Each module is built as a separate image and published (e.g., on Docker Hub) with a tag like:
somebackmagic/docker-extra-modules:<module-name>-<version>
-How It Works(#how-it-works)
- (Usage Examples)(#huage-examples)
- (Repository Structure)#(repository-structure)
- (Adding a New Module)(#adding-a-new-module)
- [Support](support
- License
<---
-
Module as a Separate Image Each extra module is built as a separate image. During the build, the Dockerfile typically includes instructions for installing binaries, dependencies, etc. After a successful build, the image is published to the container registry.
-
Multi-stage Copy To use the modules in your projects, simply use "COPY --from=..." in your Dockerfile to copy the required files from the module image.
COPY --from=someblackmagic/docker-extra-modules:<module-name-><version> / /This copies everything from the root of the extra module image to the root of the build context in your own image.
- Flexibility You can copy only the needed directories or specific binary files if you don't need everything from the module image. Example:
COPY --from=someblackmagic/docker-extra-modules:<module-name>-<version> /usr/local/bin/healthcheck /usr/local/bin/If you need envsubst version v1.4.2, you can copy the binary directly into your image:
FROM <your-base-image> AS app
# Copy the envsubst binary from the module
COPY --from=somebackmagic/docker-extra-modules:a8m-envsubst-v1.4.2 / /
CMD ["envsubst", "--help"]For including the php-fpm-healthcheck script (tag latest):
FROM <your-base-image> AS app
# Copy the healthcheck script from the module
COPY --from=someblackmagic/docker-extra-modules:php-fpm-healthceck-latest / /
HEALTHCHECK [--interval=30s --timeout=3s --start-period=5s] \n CMD /usr/local/bin/healthcheck || exit 1A possible structure for this repository:
[.
] \READUE.md
|- ao-envsubst
|- ...
\php-fpm-healthcheck
|- Dockerfile
| ...
-
a8m-envsubst/ Contains the Dockerfile and any related files (scripts, configuration, etc.) needed to build the envsubst image.
-
php-fpm-healthceck/ Contains the Dockerfile and all related files needed to build the healthcheck image for PHP-FPM.
-
README.md* The general documentation for the repository.
-
Create a Directory Create a folder named after your module (e.g, my-cool-tool.)
-
**Create a Dockerfile ** Inside the folder, place a
Dockerfilewith instructions to install the desired binary, script, etc.
FROM alpine:3.18 as builder
RUN apk add --no-cache curl
# Download and install the tool
RUN curl -L "https://example.com/my-cool-tool" -o /usr/local/bin/my-cool-tool \
&& chmod +x /usr/local/bin/my-cool-tool
FROM scratch
COPY --from=builder /usr/local/bin/my-cool-tool /usr/local/bin/my-cool-tool-
Set Version and Tags Determine the tool's version, and make sure to add the version info in the DwcMokerfile or in your build pipeline. The resulting image tag should reflect that version.
-
Document Add a short description of the module, installation commands, and usage examples in the main
README.mdor in a separate file.
If you have any questions or suggestions for improvements, you can:
- Create an issue on GitHub.
- Submit a Pull Request if you've already made the necessary changes.
This repository is distributed under the MIT license (or specify sour own license here).
Please review the license file before using this repository.
Thank you for using Docker Extra Modules!
We hope these extra modules simplify your Docker workflows. Feel free to contribute by submitting a Pull Request or creating an Issue if you have new modules or improvements in mind.