Skip to content

Commit

Permalink
EZP-30036: Add Node.js and Yarn to 7.1 and 7.2 images (ezsystems#33)
Browse files Browse the repository at this point in the history
* Add Node.js and Yarn to 7.1 and 7.2 images

* Add gnupg to installed packages

* Test whether image sieze can be descreased

* Revert "Test whether image sieze can be descreased"

This reverts commit 159a065.

* Add Node flavour

* Always build Node flavour. Add Readme and test entries
  • Loading branch information
mnocon authored and andrerom committed Feb 5, 2019
1 parent 9b6511d commit 11f9678
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -35,9 +35,13 @@ _Recommended version for testing newest versions of eZ Platform is PHP 7.2 for b

\* *Primarily: Since this is also used to run functional testing against several PHP versions, for any other usage use the recommended image.*

## Node image

For each php version there is an additional `-node` flavour with Node.js (latest LTS version) and Yarn installed, useful if your project needs it (for example for Webpack Encore).

### Dev image

For each php version there is an additional `-dev` flavour with additional tools for when you need to be able to login and work towards the installation. It contains tools like vim, git, xdebug, ... [and others](php/Dockerfile-dev).
For each php version there is an additional `-dev` flavour based on Node image, with additional tools for when you need to be able to login and work towards the installation. It contains tools like vim, git, xdebug, ... [and others](php/Dockerfile-dev).


### Format version
Expand Down
5 changes: 4 additions & 1 deletion bin/.travis/build.sh
Expand Up @@ -18,5 +18,8 @@ fi
# Build prod container
docker build --network=host --no-cache --rm=true --pull -f php/Dockerfile-${PHP_VERSION} -t ez_php:latest php/

# Build expanded dev container (will extend ez_php:latest, hence why --pull is skipped)
# Build expanded node container (will extend ez_php:latest, hence why --pull is skipped)
docker build --network=host --no-cache --rm=true -f php/Dockerfile-node -t ez_php:latest-node php/

# Build expanded dev container (will extend ez_php:latest-node, hence why --pull is skipped)
docker build --network=host --no-cache --build-arg XDEBUG_CHANNEL="$XDEBUG_CHANNEL" --rm=true -f php/Dockerfile-dev -t ez_php:latest-dev php/
6 changes: 5 additions & 1 deletion bin/.travis/push.sh
Expand Up @@ -4,6 +4,7 @@ set -e

# Expects images from build.sh, as in:
# - ez_php:latest
# - ez_php:latest-node
# - ez_php:latest-dev

validateEnvironment()
Expand All @@ -27,20 +28,23 @@ fi

REMOTE_IMAGE="$1"
PHP_VERSION=`docker -l error run ez_php:latest php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;"`
NODE_VERSION=`docker -l error run ez_php:latest-node node -e "console.log(process.versions.node)"`

docker images
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

## TAGS
echo "About to tag remote image '${REMOTE_IMAGE}' with php version '${PHP_VERSION}'"
echo "About to tag remote image '${REMOTE_IMAGE}' with php version '${PHP_VERSION}' and Node '${NODE_VERSION}'"

# "7.0"
docker tag ez_php:latest "${REMOTE_IMAGE}:${PHP_VERSION}"
docker tag ez_php:latest-node "${REMOTE_IMAGE}:${PHP_VERSION}-node"
docker tag ez_php:latest-dev "${REMOTE_IMAGE}:${PHP_VERSION}-dev"

# "7.0-v0"
if [ "$2" != "" ]; then
docker tag ez_php:latest "${REMOTE_IMAGE}:${PHP_VERSION}-${2}"
docker tag ez_php:latest-node "${REMOTE_IMAGE}:${PHP_VERSION}-${2}-node"
docker tag ez_php:latest-dev "${REMOTE_IMAGE}:${PHP_VERSION}-${2}-dev"
fi

Expand Down
7 changes: 6 additions & 1 deletion bin/.travis/test.sh
Expand Up @@ -3,6 +3,7 @@
set -e
# Expects images from build.sh, as in:
# - ez_php:latest
# - ez_php:latest-node
# - ez_php:latest-dev
REUSE_VOLUME=0

Expand Down Expand Up @@ -52,7 +53,11 @@ if [ "$REUSE_VOLUME" = "0" ]; then
bash -c "composer -v && composer create-project --prefer-dist --no-progress --no-interaction ezsystems/ezplatform /var/www $EZ_VERSION"
fi


printf "\nMake sure Node.js and Yarn are included in latest-node and latest-dev\n"
docker -l error run -a stderr ez_php:latest-node node -e "process.versions.node"
docker -l error run -a stderr ez_php:latest-dev node -e "process.versions.node"
docker -l error run -a stderr ez_php:latest-node bash -c "yarn -v"
docker -l error run -a stderr ez_php:latest-dev bash -c "yarn -v"

printf "\nMinimal testing on ez_php:latest for use with ez user\n"
docker run -ti --rm \
Expand Down
2 changes: 1 addition & 1 deletion php/Dockerfile-dev
@@ -1,4 +1,4 @@
FROM ez_php
FROM ez_php:latest-node

ARG XDEBUG_CHANNEL="xdebug"

Expand Down
11 changes: 11 additions & 0 deletions php/Dockerfile-node
@@ -0,0 +1,11 @@
FROM ez_php

# Install Node.js and Yarn
RUN apt-get update -q -y \
&& apt-get install -q -y --no-install-recommends gnupg \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs \
&& curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& sudo apt-get update && sudo apt-get install yarn \
&& rm -rf /var/lib/apt/lists/*

0 comments on commit 11f9678

Please sign in to comment.