Skip to content

Instantly share code, notes, and snippets.

@jonhattan
Last active September 3, 2024 09:47
Show Gist options
  • Save jonhattan/3deb997a98861d50bf98b7f3ded70110 to your computer and use it in GitHub Desktop.
Save jonhattan/3deb997a98861d50bf98b7f3ded70110 to your computer and use it in GitHub Desktop.
Bash wrapper to run composer via docker
#!/bin/bash
# Place this file in /usr/local/bin/composer and chmod +x
docker run --rm \
-u `id -u`:`id -g` \
--volume "${PWD}":/app \
--volume "${COMPOSER_HOME:-$HOME/.composer}":/tmp \
--volume "$SSH_AUTH_SOCK":/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \
--volume /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts \
--volume /etc/passwd:/etc/passwd:ro \
composer:2 "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment