Skip to content

Instantly share code, notes, and snippets.

@PurpleBooth
Last active February 13, 2017 23:14
Show Gist options
  • Save PurpleBooth/4a8dd1c0a055dea9e47e736c9220b44f to your computer and use it in GitHub Desktop.
Save PurpleBooth/4a8dd1c0a055dea9e47e736c9220b44f to your computer and use it in GitHub Desktop.
I am on a system with docker but without PHP
#!/bin/bash
set -euo pipefail
if [ ! -d "$HOME/.composer" ]; then
mkdir "$HOME/.composer"
touch "$HOME/.composer/.lastpull"
fi
if test find "$HOME/.composer/" -name ".lastpull" -and -mtime +7 > /dev/null 2>&1 ; then
docker pull composer
touch "$HOME/.composer/.lastpull"
fi
docker run \
-t \
--net host \
--interactive \
--rm \
--user "$(id -u):$(id -g)" \
--volume /etc/passwd:/etc/passwd:ro \
--volume /etc/group:/etc/group:ro \
--volume "$HOME/.ssh:/app/.ssh" \
--volume "$(pwd):/app" \
--volume "$SSH_AUTH_SOCK:/ssh-auth.sock" \
--volume "$HOME/.composer:/composer" \
--env SSH_AUTH_SOCK=/ssh-auth.sock \
composer "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment