mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Add integrations anchor and preliminary framework integrations to docs
This commit is contained in:
62
docs/integrations/platforms/docker-compose.mdx
Normal file
62
docs/integrations/platforms/docker-compose.mdx
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: "Docker Compose"
|
||||
---
|
||||
|
||||
The Docker Compose integration enables you to inject environment variables from Infisical into the containers defined in your compose file.
|
||||
|
||||
## Add the CLI to your Dockerfile(s)
|
||||
|
||||
Follow steps 1 through 3 on our [guide to configure Infisical CLI](../integrations/platforms/docker) in your Dockerfile.
|
||||
|
||||
## Generate Infisical Token
|
||||
|
||||
In order for Infisical CLI to authenticate and retrieve your project's secrets without exposing your login credentials, you must generate a Infisical Token.
|
||||
To learn how, visit [Infisical Token](../getting-started/cli/infisical-token). Once you have generated the token, keep it handy.
|
||||
|
||||
<Info>
|
||||
If you have multiple services and they do not use the same secrets, you will
|
||||
have to generate a Infisical Token for each service.
|
||||
</Info>
|
||||
|
||||
## Tell Docker Compose your Infisical Token
|
||||
|
||||
For each service you want to inject secrets into, set an environment variable called `INFISICAL_TOKEN` equal to a helpful identifier variable.
|
||||
This will ensure that you can set Infisical Tokens for multiple services.
|
||||
|
||||
For the example below, we have set `INFISICAL_TOKEN_FOR_WEB` and `INFISICAL_TOKEN_FOR_API` as the `INFISICAL_TOKEN` for the corresponding service.
|
||||
|
||||
```yaml
|
||||
# Example Docker Compose file
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
image: auledge-frontend
|
||||
container_name: auledge-frontend
|
||||
environment:
|
||||
- INFISICAL_TOKEN=${INFISICAL_TOKEN_FOR_WEB}
|
||||
|
||||
api:
|
||||
build: .
|
||||
image: auledge-backend
|
||||
container_name: auledge-backend
|
||||
environment:
|
||||
- INFISICAL_TOKEN=${INFISICAL_TOKEN_FOR_API}
|
||||
```
|
||||
|
||||
## Export shell variables
|
||||
|
||||
Next, set the shell variables you defined in your compose file. This can be done manually or via your CI/CD environment. Once done, it will be used to populate the corresponding `INFISICAL_TOKEN`
|
||||
in your Docker Compose file.
|
||||
|
||||
```bash
|
||||
#Example
|
||||
|
||||
# Token refers to the token we generated in step 2 for this service
|
||||
export INFISICAL_TOKEN_FOR_WEB=<token>
|
||||
|
||||
# Token refers to the token we generated in step 2 for this service
|
||||
export INFISICAL_TOKEN_FOR_API=<token>
|
||||
|
||||
# Then run your compose file in the same terminal.
|
||||
docker-compose ...
|
||||
```
|
||||
60
docs/integrations/platforms/docker.mdx
Normal file
60
docs/integrations/platforms/docker.mdx
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: "Docker"
|
||||
---
|
||||
|
||||
Infisical can be used in a Dockerfile to inject environment variables into a Docker container.
|
||||
|
||||
## Add the CLI to your Dockerfile
|
||||
|
||||
<Tabs>
|
||||
<Tab title="Alpine">
|
||||
```dockerfile
|
||||
RUN apk add --no-cache bash curl && curl -1sLf \
|
||||
'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.alpine.sh' | bash \
|
||||
&& apk add infisical
|
||||
```
|
||||
|
||||
</Tab>
|
||||
<Tab title="RedHat/CentOs/Amazon-linux">
|
||||
```dockerfile
|
||||
RUN curl -1sLf \
|
||||
'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.rpm.sh' | sh \
|
||||
&& yum install -y infisical
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="Debian/Ubuntu">
|
||||
```dockerfile
|
||||
RUN apt-get update && apt-get install -y bash curl && curl -1sLf \
|
||||
'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \
|
||||
&& apt-get update && apt-get install -y infisical
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## Modify the start command in your Dockerfile
|
||||
|
||||
```dockerfile
|
||||
CMD ["infisical", "--env=[env]", "projectId=[projectId]", "run", "---", "[your application start command]"]
|
||||
|
||||
# example
|
||||
CMD ["infisical", "--env=prod", "projectId=62faf98ae0b05e83239b5da41", "run", "---", "npm run start"]
|
||||
```
|
||||
|
||||
Required options:
|
||||
|
||||
| Option | Description | Default value |
|
||||
| ------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
|
||||
| `--env` | Used to set the environment that secrets are pulled from. Accepted values: `dev`, `staging`, `test`, `prod` | `dev` |
|
||||
| `--projectId` | Used to link a local project to the platform | `None` |
|
||||
|
||||
## Generate an Infisical Token
|
||||
|
||||
[Generate an Infisical Token](../../getting-started/dashboard/token) and keep it handy.
|
||||
|
||||
## Feed Docker your Infisical Token
|
||||
|
||||
The CLI looks out for an environment variable called `INFISICAL_TOKEN`. If the token is detected, the CLI will authenticate, retrieve, and inject the environment variables which the token is authorized for.
|
||||
|
||||
```bash
|
||||
docker run --env INFISICAL_TOKEN=[token]...
|
||||
```
|
||||
Reference in New Issue
Block a user