Skip to content

Instantly share code, notes, and snippets.

@FaHuSchmidt
Last active November 4, 2017 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FaHuSchmidt/d748b3d732a4ddc6f97f1baefe57452f to your computer and use it in GitHub Desktop.
Save FaHuSchmidt/d748b3d732a4ddc6f97f1baefe57452f to your computer and use it in GitHub Desktop.
wrapper script for using composer with Docker

This script can be used to execute composer commands at your current work dir without the need of having php installed locally.

The only requirement is a running Docker instance.

Basic usages:

./composer --version
./composer install
...

Further informations on configuring composer command can be found at https://hub.docker.com/_/composer/.

#!/usr/bin/env bash
tty=
tty -s && tty=--tty
docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume $(pwd):/app \
composer "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment