diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2d73d7ac5909d6554c455b7f23c77d6ab6c891b..f0720c907b45decf4a56a14a9504044f8513610f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,37 @@ +variables: + VERSION: ${CI_COMMIT_TAG} + before_script: - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY -php-7.0: - stage: build - script: - - docker build --pull --build-arg ALPINE_VERSION=3.5 --build-arg PHP_VERSION=7.0 -t $CI_REGISTRY_IMAGE:php-7.0 . - - docker push $CI_REGISTRY_IMAGE:php-7.0 - only: - - master +#php-7.0: +# stage: build +# script: +# - docker build --pull --build-arg ALPINE_VERSION=3.5 --build-arg PHP_VERSION=7.0 --build-arg VERSION=${VERSION} -t $CI_REGISTRY_IMAGE:php-7.0 . +# - docker push $CI_REGISTRY_IMAGE:php-7.0 +# only: +# - master -php-7.1: +#php-7.1: +# stage: build +# script: +# - docker build --pull --build-arg ALPINE_VERSION=3.7 --build-arg PHP_VERSION=7.1 --build-arg VERSION=${VERSION} -t $CI_REGISTRY_IMAGE:php-7.1 . +# - docker push $CI_REGISTRY_IMAGE:php-7.1 +# only: +# - master + +php-7.2: stage: build script: - - docker build --pull --build-arg ALPINE_VERSION=3.7 --build-arg PHP_VERSION=7.1 -t $CI_REGISTRY_IMAGE:php-7.1 . - - docker push $CI_REGISTRY_IMAGE:php-7.1 + - docker build --pull --build-arg ALPINE_VERSION=3.8 --build-arg PHP_VERSION=7.2 --build-arg VERSION=${VERSION} -t $CI_REGISTRY_IMAGE:php-7.2 . + - docker push $CI_REGISTRY_IMAGE:php-7.2 only: - master -php-7.2: +php-7.3: stage: build script: - - docker build --pull --build-arg ALPINE_VERSION=3.8 --build-arg PHP_VERSION=7.2 -t $CI_REGISTRY_IMAGE:php-7.2 . - - docker push $CI_REGISTRY_IMAGE:php-7.2 + - docker build --pull --build-arg ALPINE_VERSION=3.11 --build-arg PHP_VERSION=7.3 --build-arg VERSION=${VERSION} -t $CI_REGISTRY_IMAGE:php-7.3 . + - docker push $CI_REGISTRY_IMAGE:php-7.3 only: - master diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000000000000000000000000000000000000..397593be411967c6de33caa37c1d92b033b27c79 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,11 @@ +v1.4.0 2020-01-12 +----------------- +Add version to the images again +docker/l3d#4 Set permissions after "drush generate" +docker/l3d#39 Update to git-extras version 5.1.0 by hard-copying column as a binary +docker/l3d#34 Add support for PHP 7.3 +docker/l3d#36 Add apropos which also brings man +docker/l3d#37 Add phpstan script which runs in its own docker container +docker/l3d#38 Update Docker to 19.03.5 +docker/l3d#38 Update Docker Compose to 1.25.1 +docker/l3d#40 Update to Python 3 No longer update image for PHP 7.0 and 7.1 diff --git a/Dockerfile b/Dockerfile index 0ed31ff30a62efc05a7f91b40c60947589d6a459..2ea2e24d3bdc7bd93b9676bee82919137d580c38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,26 @@ -FROM alpine:3.8 +ARG ALPINE_VERSION + +FROM alpine:${ALPINE_VERSION} + +ARG VERSION LABEL com.example.vendor="LakeDrops" \ maintainer="juergen.haas@lakedrops.com" \ - version="1.5.2" \ + version="${VERSION}" \ description="An image for GitLab runner to build and test Drupal projects." ARG ALPINE_VERSION ARG PHP_VERSION -ARG compose_version=1.21.2 +ARG compose_version=1.25.1 ARG glibc_version=2.28-r0 ARG apkArch ARG dockerArch ARG DOCKER_CHANNEL=stable -ARG DOCKER_VERSION=18.06.1-ce +ARG DOCKER_VERSION=19.03.5 +ARG GIT_EXTRAS_VERSION=5.1.0 +ARG AHOY_VERSION=2.0.0 + +ADD usrbin/column /usr/bin/column RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \ set -eux && \ @@ -41,7 +49,7 @@ RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \ echo "StrictHostKeyChecking no" >> /root/.ssh/config && \ \ apk update && \ - apk add --no-cache openssh wget make patch bash fish python git git-lfs unzip acl && \ + apk add --no-cache mdocml-apropos openssh wget make patch bash fish python3 git git-lfs unzip acl && \ \ wget -q https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -O /etc/apk/keys/sgerrand.rsa.pub && \ wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${glibc_version}/glibc-${glibc_version}.apk && \ @@ -51,8 +59,10 @@ RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \ ln -s /lib/libc.musl-x86_64.so.1 /usr/glibc-compat/lib && \ ln -s /usr/lib/libgcc_s.so.1 /lib/libgcc_s.so.1 && \ ln -s /lib/libgcc_s.so.1 /usr/glibc-compat/lib/ && \ + ln -s python3 /usr/bin/python && \ + ln -s pip3 /usr/bin/pip && \ \ - wget -q https://github.com/ahoy-cli/ahoy/releases/download/2.0.0/ahoy-bin-`uname -s`-amd64 -O /usr/local/bin/ahoy && \ + wget -q https://github.com/ahoy-cli/ahoy/releases/download/${AHOY_VERSION}/ahoy-bin-`uname -s`-amd64 -O /usr/local/bin/ahoy && \ chmod +x /usr/local/bin/ahoy && \ \ wget -q https://github.com/docker/compose/releases/download/${compose_version}/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose && \ @@ -63,8 +73,7 @@ RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \ \ git clone https://github.com/tj/git-extras.git && \ cd git-extras && \ - #git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) && \ - git checkout 4.7.0 && \ + git checkout ${GIT_EXTRAS_VERSION} && \ make install && \ cd .. && \ rm -rf git-extras && \ @@ -85,6 +94,9 @@ RUN echo 'hosts: files dns' > /etc/nsswitch.conf && \ if [ "${PHP_VERSION}" = "7.2" ]; then \ apk add --no-cache php7-sodium ; \ fi && \ + if [ "${PHP_VERSION}" = "7.3" ]; then \ + apk add --no-cache php7-sodium ; \ + fi && \ rm /etc/apk/repositories && \ mv /etc/apk/repositories.org /etc/apk/repositories && \ apk update && \ diff --git a/bin/drush b/bin/drush index 73d6186bcaccbdfd4a369f77efbee72d04d1068d..8b92d022451fcfab606a4ced32f0279a69a688cf 100755 --- a/bin/drush +++ b/bin/drush @@ -1,3 +1,14 @@ #!/bin/sh +function setPermissions { + chmod -R g+w . +} + docker-compose exec ${LAKEDROPS_DEV_DC_OPTIONS} --user root php drush $@ + +if [[ "$1" == "gen" ]]; then + setPermissions +fi +if [[ "$1" == "generate" ]]; then + setPermissions +fi diff --git a/bin/phpstan b/bin/phpstan new file mode 100755 index 0000000000000000000000000000000000000000..26807077f740a6880b08a3839084780e56544243 --- /dev/null +++ b/bin/phpstan @@ -0,0 +1,4 @@ +#!/bin/bash + +export $(cat .env | xargs) +docker run --rm -v $(php /usr/local/bin/volume.php /app) phpstan/phpstan "$@" diff --git a/bin/volume.php b/bin/volume.php index e2db5ee329d0a69490d21147b6196f483dbaed93..aa9e78c2bb28a26ae5522b3b943bdb20aa587c33 100644 --- a/bin/volume.php +++ b/bin/volume.php @@ -16,15 +16,17 @@ function readContainerConfig() { return []; } -function getDockerMountSource() { +function getDockerMountSource($args) { $currentDir = getcwd(); + $destDir = (empty($args[1])) ? $currentDir : $args[1]; + $container = readContainerConfig(); foreach ($container['Mounts'] as $mount) { if (strpos($currentDir, $mount['Destination']) === 0) { - return $mount['Source'] . ':' . $mount['Destination']; + return $mount['Source'] . ':' . (empty($args[1]) ? $mount['Destination'] : $destDir); } } - return $currentDir . ':' . $currentDir; + return $currentDir . ':' . $destDir; } -print(getDockerMountSource()); +print(getDockerMountSource($argv)); diff --git a/usrbin/column b/usrbin/column new file mode 100755 index 0000000000000000000000000000000000000000..ca9dfd2074dd4cc100fe2eee2bc24a7a0b8ba4cc Binary files /dev/null and b/usrbin/column differ