The Infisical CLI is powerful command line tool that can be used to retrieve, modify, export and inject secrets into any process or application as environment variables. You can use it across various environments, whether it’s local development, CI/CD, staging, or production.
This Dockerfile creates a lightweight container using the Alpine 3.20.3 base image and installs the Infisical CLI with a specified version. The Dockerfile ensures a minimal image size by using Alpine Linux and cleaning up unnecessary files after installation.
- INFISICAL_VERSION: Defines the version of Infisical CLI to install. The default version is
0.31.0
, but this can be overridden at build time.
-
Base Image:
The Dockerfile usesalpine:3.20.3
as the base image, which is known for its small size and efficiency.FROM alpine:3.20.3
-
Build Argument:
Defines a build argument for the Infisical version, defaulting to0.31.0
. You can customize the version during the build.ARG INFISICAL_VERSION=0.31.0
-
Installing Dependencies:
The Dockerfile installs the following dependencies:curl
: To download the installation script.gnupg
: For signature verification (if required by the script).bash
: To run the installation script.
RUN apk --no-cache add curl gnupg bash \
-
Infisical CLI Installation:
The Infisical CLI is installed using a setup script hosted on Cloudsmith. The installation is done viacurl
, and the version is specified using theINFISICAL_VERSION
argument.&& curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' | bash \
-
Installing Infisical:
Installs the Infisical CLI based on the version defined in theINFISICAL_VERSION
argument.&& apk --no-cache add infisical=${INFISICAL_VERSION} \
-
Cleaning Up:
To minimize the final image size, temporary files and package manager caches are removed.&& rm -rf /var/cache/apk/* /tmp/* /var/lib/apt/lists/*
To build the Docker image, use the following command. You can specify a different Infisical version by passing the build argument:
docker build --build-arg INFISICAL_VERSION=0.32.0 -t infisical-image .
This command will build the image with Infisical version 0.32.0
. If you don't provide a version, it defaults to 0.31.0
.
Once the image is built, you can run a container based on this image:
docker run -it infisical-image infisical --help
This command runs the Infisical CLI inside the container.