From f515e33780488dc9ba4fb90b2a799296d4311a71 Mon Sep 17 00:00:00 2001 From: Bastian Rang Date: Thu, 24 Aug 2017 18:08:11 +0200 Subject: [PATCH] refs #31 * optimize Docker image build * remove dev-packages from image --- Dockerfile | 19 ++++++++++--------- composer.json | 10 +++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 419e8ac..ce798c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,25 +25,26 @@ RUN apk update \ && apk add --no-cache \ git \ docker \ - py-pip - -COPY [".", "/opt/rancherize"] -WORKDIR /opt/rancherize + py-pip \ +# install docker-compose + && pip install docker-compose==$DOCKER_COMPOSE_VERSION \ + && apk del py-pip # load rancher-compose RUN curl -SL "https://github.com/rancher/rancher-compose/releases/download/v$RANCHER_COMPOSE_VERSION/rancher-compose-linux-amd64-v$RANCHER_COMPOSE_VERSION.tar.gz" \ | tar xz \ - && mv rancher-compose-*/rancher-compose /usr/local/bin/ && cp /usr/local/bin/rancher-compose /usr/local/bin/rancher-compose-$RANCHER_COMPOSE_VERSION + && mv rancher-compose-*/rancher-compose /usr/local/bin/ \ + && cp /usr/local/bin/rancher-compose /usr/local/bin/rancher-compose-$RANCHER_COMPOSE_VERSION + +COPY [".", "/opt/rancherize"] +WORKDIR /opt/rancherize # install composer packages RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ && php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \ && php composer-setup.php \ && php -r "unlink('composer-setup.php');" \ - && ./composer.phar install && rm composer.phar - -# install docker-compose -RUN pip install docker-compose==$DOCKER_COMPOSE_VERSION + && ./composer.phar install --no-dev && rm composer.phar ENTRYPOINT ["/opt/rancherize/rancherize"] #ENTRYPOINT ["/bin/sh"] \ No newline at end of file diff --git a/composer.json b/composer.json index d99163e..46418fc 100644 --- a/composer.json +++ b/composer.json @@ -22,14 +22,14 @@ "symfony/event-dispatcher": "^3.1", "symfony/yaml": "^3.1", "pimple/pimple": "^3.0", - "symfony/process": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^5.6", - "mockery/mockery": "^0.9.9", + "symfony/process": "^3.1", "ipunkt/rancherize-backup-storagebox": "^1.0.3", "ipunkt/rancherize-ecr": "^1.0.0", "ipunkt/rancherize-publish-traefik-rancher": "^1.0.2", "ipunkt/rancherize-blueprint-php-cli": "^1.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.6", + "mockery/mockery": "^0.9.9" } }