Published: 2024-10-04
Create a new fine-grained GitHub PAT with read-only access to Contents on repositories you want Composer to access.
Add GitHub PAT as JSON to your environment variables
# Replace `github_pat_xxx` with your token
COMPOSER_AUTH_JSON='{ "github-oauth": { "github.com": "github_pat_XXXX" } }'
docker-compose.yaml
and Dockerfile
# docker-compose.yaml
services:
php:
build:
secrets:
- COMPOSER_AUTH_JSON
secrets:
COMPOSER_AUTH_JSON:
environment: COMPOSER_AUTH_JSON
# Dockerfile
RUN --mount=type=secret,id=composer_auth_json,dst=/app/auth.json \
composer install --no-autoloader --no-ansi --no-dev --no-interaction --no-plugins --no-progress --no-scripts
[!IMPORTANT]
Using Coolify? Check out this article on how to use build secrets in Coolify.
All content © Kimmo Salmela — Source on GitHub