Commit 0b5dd356 authored by Sascha Marcel Schmidt's avatar Sascha Marcel Schmidt
Browse files

adds composer script that uses composer container and is now being used

instead of the php container
parent c8fc4357
......@@ -19,6 +19,6 @@ log:
down:
$(DOCKER_COMPOSE) down --remove-orphans
composer-install:
$(DOCKER_COMPOSE) run --rm --no-deps php composer install
$(COMPOSER) --working-dir=data/typo3 install
composer-update:
$(DOCKER_COMPOSE) run --rm --no-deps php composer update
$(COMPOSER) --working-dir=data/typo3 up
#!/bin/bash
#
# Run composer in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#
# You can add additional volumes (or any docker run options) using
# the $COMPOSER_OPTIONS environment variable.
#
set -e
VERSION="1.2-alpine"
IMAGE="composer/composer:$VERSION"
SSH_IDENTITY_FILE=${SSH_IDENTITY_FILE:-~/.ssh/id_rsa}
COMPOSER_CACHE=${COMPOSER_CACHE:-/tmp/composer}
# Setup volume mounts for composer config, context and ssh keys
if [ "$(pwd)" != '/' ]; then
VOLUMES="-v $(pwd):$(pwd)"
fi
if [ -n "$COMPOSER_FILE" ]; then
composer_dir=$(dirname $COMPOSER_FILE)
fi
# TODO: also check --file argument
if [ -n "$composer_dir" ]; then
VOLUMES="$VOLUMES -v $composer_dir:$composer_dir"
fi
if [ -n "$SSH_IDENTITY_FILE" ]; then
ssh_identity_dir=$(dirname $SSH_IDENTITY_FILE)
fi
# TODO: also check --file argument
if [ -n "$ssh_identity_dir" ]; then
VOLUMES="$VOLUMES -v $ssh_identity_dir:/root/.ssh"
fi
if [ -n "$COMPOSER_CACHE" ]; then
composer_cache_dir=$(dirname $COMPOSER_CACHE)
fi
# TODO: also check --file argument
if [ -n "$composer_cache_dir" ]; then
VOLUMES="$VOLUMES -v $composer_cache_dir:/composer/cache"
fi
if [ -n "$HOME" ]; then
VOLUMES="$VOLUMES -v $HOME:$HOME -v $HOME:/root" # mount $HOME in /root to share docker.config
fi
# Only allocate tty if we detect one
if [ -t 1 ]; then
DOCKER_RUN_OPTIONS="-t"
fi
if [ -t 0 ]; then
DOCKER_RUN_OPTIONS="$DOCKER_RUN_OPTIONS -i"
fi
exec docker run --rm -u $(id -u) $DOCKER_RUN_OPTIONS $COMPOSER_OPTIONS $VOLUMES -w "$(pwd)" $IMAGE "$@"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment