From 3d3fea3c8e0a13ba41f7fad4662749ae64ef76fb Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Fri, 21 Dec 2018 16:34:33 +0100 Subject: [PATCH] #1 Remove node stuff and make use of a separate container instead --- php-7.0/Dockerfile | 9 ++++++--- php-7.0/node | 3 +++ php-7.0/npm | 3 +++ php-7.0/volume.php | 30 ++++++++++++++++++++++++++++++ php-7.1/Dockerfile | 9 ++++++--- php-7.1/node | 3 +++ php-7.1/npm | 3 +++ php-7.1/volume.php | 30 ++++++++++++++++++++++++++++++ php-7.2/Dockerfile | 9 ++++++--- php-7.2/node | 3 +++ php-7.2/npm | 3 +++ php-7.2/volume.php | 30 ++++++++++++++++++++++++++++++ 12 files changed, 126 insertions(+), 9 deletions(-) create mode 100755 php-7.0/node create mode 100755 php-7.0/npm create mode 100644 php-7.0/volume.php create mode 100755 php-7.1/node create mode 100755 php-7.1/npm create mode 100644 php-7.1/volume.php create mode 100755 php-7.2/node create mode 100755 php-7.2/npm create mode 100644 php-7.2/volume.php diff --git a/php-7.0/Dockerfile b/php-7.0/Dockerfile index 8b631ce..9e5e624 100644 --- a/php-7.0/Dockerfile +++ b/php-7.0/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.5 LABEL com.example.vendor="LakeDrops" \ maintainer="juergen.haas@lakedrops.com" \ - version="1.3.0" \ + version="1.4.0" \ description="An image for GitLab runner to build and test Drupal projects." ARG compose_version=1.21.2 @@ -59,6 +59,9 @@ RUN set -eux; \ COPY modprobe.sh /usr/local/bin/modprobe COPY docker-entrypoint.sh /usr/local/bin/ COPY drush.sh /usr/local/bin/drush +COPY node /usr/local/bin/node +COPY npm /usr/local/bin/npm +COPY volume.php /usr/local/bin/volume.php ENTRYPOINT ["docker-entrypoint.sh"] CMD ["sh"] @@ -67,8 +70,8 @@ RUN mkdir -p /root/.ssh && \ echo "StrictHostKeyChecking no" >> /root/.ssh/config && \ \ apk update && \ - apk add --no-cache curl openssl openssh ca-certificates wget make patch g++ \ - bash fish python nodejs git unzip \ + apk add --no-cache curl openssl openssh ca-certificates wget make patch \ + bash fish python git unzip \ php7 php7-phar php7-json php7-dom php7-gd php7-mbstring php7-openssl \ php7-pdo php7-curl php7-xml php7-zip php7-session php7-ctype php7-iconv php7-bcmath && \ \ diff --git a/php-7.0/node b/php-7.0/node new file mode 100755 index 0000000..4f9fbb5 --- /dev/null +++ b/php-7.0/node @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim node $@ diff --git a/php-7.0/npm b/php-7.0/npm new file mode 100755 index 0000000..0db3164 --- /dev/null +++ b/php-7.0/npm @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim npm $@ diff --git a/php-7.0/volume.php b/php-7.0/volume.php new file mode 100644 index 0000000..e2db5ee --- /dev/null +++ b/php-7.0/volume.php @@ -0,0 +1,30 @@ +<?php + + +function readContainerConfig() { + try { + $output = []; + exec('basename "$(cat /proc/1/cpuset)"', $output); + $id = reset($output); + $output = []; + exec('docker container inspect ' . $id, $output); + return json_decode(implode('', $output), TRUE)[0]; + } + catch (\Exception $ex) { + // Ignore. + } + return []; +} + +function getDockerMountSource() { + $currentDir = getcwd(); + $container = readContainerConfig(); + foreach ($container['Mounts'] as $mount) { + if (strpos($currentDir, $mount['Destination']) === 0) { + return $mount['Source'] . ':' . $mount['Destination']; + } + } + return $currentDir . ':' . $currentDir; +} + +print(getDockerMountSource()); diff --git a/php-7.1/Dockerfile b/php-7.1/Dockerfile index 8a32698..478caf0 100644 --- a/php-7.1/Dockerfile +++ b/php-7.1/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.7 LABEL com.example.vendor="LakeDrops" \ maintainer="juergen.haas@lakedrops.com" \ - version="1.3.0" \ + version="1.4.0" \ description="An image for GitLab runner to build and test Drupal projects." ARG compose_version=1.21.2 @@ -54,6 +54,9 @@ RUN set -eux; \ COPY modprobe.sh /usr/local/bin/modprobe COPY docker-entrypoint.sh /usr/local/bin/ COPY drush.sh /usr/local/bin/drush +COPY node /usr/local/bin/node +COPY npm /usr/local/bin/npm +COPY volume.php /usr/local/bin/volume.php ENTRYPOINT ["docker-entrypoint.sh"] CMD ["sh"] @@ -62,8 +65,8 @@ RUN mkdir -p /root/.ssh && \ echo "StrictHostKeyChecking no" >> /root/.ssh/config && \ \ apk update && \ - apk add --no-cache curl openssl openssh ca-certificates wget make patch g++ \ - bash fish python nodejs git unzip \ + apk add --no-cache curl openssl openssh ca-certificates wget make patch \ + bash fish python git unzip \ php7 php7-phar php7-json php7-dom php7-gd php7-mbstring php7-openssl \ php7-pdo php7-curl php7-xml php7-zip php7-session php7-ctype php7-iconv php7-bcmath \ php7-tokenizer php7-simplexml php7-xmlwriter && \ diff --git a/php-7.1/node b/php-7.1/node new file mode 100755 index 0000000..4f9fbb5 --- /dev/null +++ b/php-7.1/node @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim node $@ diff --git a/php-7.1/npm b/php-7.1/npm new file mode 100755 index 0000000..0db3164 --- /dev/null +++ b/php-7.1/npm @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim npm $@ diff --git a/php-7.1/volume.php b/php-7.1/volume.php new file mode 100644 index 0000000..e2db5ee --- /dev/null +++ b/php-7.1/volume.php @@ -0,0 +1,30 @@ +<?php + + +function readContainerConfig() { + try { + $output = []; + exec('basename "$(cat /proc/1/cpuset)"', $output); + $id = reset($output); + $output = []; + exec('docker container inspect ' . $id, $output); + return json_decode(implode('', $output), TRUE)[0]; + } + catch (\Exception $ex) { + // Ignore. + } + return []; +} + +function getDockerMountSource() { + $currentDir = getcwd(); + $container = readContainerConfig(); + foreach ($container['Mounts'] as $mount) { + if (strpos($currentDir, $mount['Destination']) === 0) { + return $mount['Source'] . ':' . $mount['Destination']; + } + } + return $currentDir . ':' . $currentDir; +} + +print(getDockerMountSource()); diff --git a/php-7.2/Dockerfile b/php-7.2/Dockerfile index c46e652..92c8ea8 100644 --- a/php-7.2/Dockerfile +++ b/php-7.2/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.8 LABEL com.example.vendor="LakeDrops" \ maintainer="juergen.haas@lakedrops.com" \ - version="1.3.0" \ + version="1.4.0" \ description="An image for GitLab runner to build and test Drupal projects." ARG compose_version=1.21.2 @@ -54,6 +54,9 @@ RUN set -eux; \ COPY modprobe.sh /usr/local/bin/modprobe COPY docker-entrypoint.sh /usr/local/bin/ COPY drush.sh /usr/local/bin/drush +COPY node /usr/local/bin/node +COPY npm /usr/local/bin/npm +COPY volume.php /usr/local/bin/volume.php ENTRYPOINT ["docker-entrypoint.sh"] CMD ["sh"] @@ -62,8 +65,8 @@ RUN mkdir -p /root/.ssh && \ echo "StrictHostKeyChecking no" >> /root/.ssh/config && \ \ apk update && \ - apk add --no-cache curl openssl openssh ca-certificates wget make patch g++ \ - bash fish python nodejs npm git unzip \ + apk add --no-cache curl openssl openssh ca-certificates wget make patch \ + bash fish python git unzip \ php7 php7-phar php7-json php7-dom php7-gd php7-mbstring php7-openssl \ php7-pdo php7-curl php7-xml php7-zip php7-session php7-ctype php7-iconv php7-bcmath \ php7-tokenizer php7-simplexml php7-xmlwriter && \ diff --git a/php-7.2/node b/php-7.2/node new file mode 100755 index 0000000..4f9fbb5 --- /dev/null +++ b/php-7.2/node @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim node $@ diff --git a/php-7.2/npm b/php-7.2/npm new file mode 100755 index 0000000..0db3164 --- /dev/null +++ b/php-7.2/npm @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it -v $(php /usr/local/bin/volume.php) -w $PWD node:8-jessie-slim npm $@ diff --git a/php-7.2/volume.php b/php-7.2/volume.php new file mode 100644 index 0000000..e2db5ee --- /dev/null +++ b/php-7.2/volume.php @@ -0,0 +1,30 @@ +<?php + + +function readContainerConfig() { + try { + $output = []; + exec('basename "$(cat /proc/1/cpuset)"', $output); + $id = reset($output); + $output = []; + exec('docker container inspect ' . $id, $output); + return json_decode(implode('', $output), TRUE)[0]; + } + catch (\Exception $ex) { + // Ignore. + } + return []; +} + +function getDockerMountSource() { + $currentDir = getcwd(); + $container = readContainerConfig(); + foreach ($container['Mounts'] as $mount) { + if (strpos($currentDir, $mount['Destination']) === 0) { + return $mount['Source'] . ':' . $mount['Destination']; + } + } + return $currentDir . ':' . $currentDir; +} + +print(getDockerMountSource()); -- GitLab