diff --git a/.travis.yml b/.travis.yml index c2d91a7..6ff4535 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,173 +4,192 @@ # # +if: tag IS blank + services: - docker +branches: + only: + - master + env: global: - DOCKER_USERNAME: garypendergast + - GITHUB_USERNAME: pento + # DOCKER_PASSWORD - secure: usv1haWO4zKTM0Ewc/boDRTJTeje6pHYXxBMpf6ny58nvqYlcGfso/UDk6ZlAu/B3/uNrEzf7NqRibJduqmq4RNLqgI7DCFSJuyxXntuSK1/CRJso1+lGYBQKAKoRDb01i1+6qy511LpyZa/nta4FxD0LmrTVNkmurQMQsQIUq5GsSDpbbSmrCZ/oKFQu+mwLnLc1hpbsHdDAjwEiqMW7GGAD5xPmwUa2jV1ZhiKikifggZIpPCnHtKj5a3oGtYVzA9t0TfMkI42Xw089ViZ+7EEmLEG1oGGpZlixZFNE/tgrRF/JmekFYusIOVPEfPEJDMzmGCJwqSanhXxnSHc2OVTJ99CyGXqASKcppRrpxZmBq4j/3tT7aZdXehxoa3+7Ba0wgHqT6n0rJDXq+soZXZZo01hBJxsNKFx9jxkS1EUdKRDCE+sOytfgPFU4nraSjqGOsFQfNYVwW60nMI0Y637k/797SjgZeM6zjXarNpllsaaog3CL+sP+YPKDF9V9CiMUIPi5d5gBBvOts2CKEWgIxuSoukIfjejU4obKC79DOdTGdDYydXRBk4289BY4vtQtr+P7ORMJW1cZ/MFd2Nbxte1OmuE6MoAv2xzutJLJDTNxISC25zI6VdukAtC+F8/HHRzi3ysJO2fr3rH2da6Z8Jep7dSRL4iE0D5S0U= + # GITHUB_TOKEN + - secure: Y8TKVQ9hWYdffxRliIDDDoXCF1FyOeOJ+oq9cRVeMG5/wgofor/3vhN2anOdwrrsoQvmoDwJII97iT9mcKnmQe6UV/LnZXXw/P1peWJOaDsKbwEX+07agNVQKdefqaxi5Jr1wDMgkadn39VU7/haXrsjqJ3Wbnu5AfcGnIzxfVnLjehkuSSOOmQy3w+RwW+HymLVpFqevfhED4uJjrjvwUEvtirxG0E3nyKXGsjusPSDGVzZhmLJBXEHf0g717loN1b+JeUa6TeIYGQ5vM/oRsyzxeJJ0iltiTKk31JHtBP+TTcoyHKWqOzefVfoXCNbk1G2Ez8czUqWIfQK8YnIHOmneUeSi6lQbCdcMSWbv/bJ5+wEJgsQKGBxy7qfF8v0T/GoMSi1OM6JfkcgW3bhuBgMGdnwxJUJ/lmYYAYlmXcO/+cui7lmyXsMT44lArdCZFo9SGt5IlPL4BW5SODYrDFKzP+2uHsj56flK03/lt+/KNJjLZKvH6NbzfhESRzMChnFFaz5eWxHgMZJefO5S51zI/88gu8YZgQDahpgIQUKvZKqi1dSASfVQ7jGqKj3roNKu2s4IdQoMXELeIehrsn9bw6BiN1kaL8yyAXjWLry21VXH0VYv0FdF4W7j23Wv7GWbcg0THDSydLvLYICPBi7NyU3yCPsGGlGpT8Oe9A= + - PR_TAG: $(if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "-$TRAVIS_PULL_REQUEST"; else echo ""; fi) + - PACKAGE_REGISTRY_HOST: $(if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "docker.pkg.github.com"; else echo ""; fi) + - PACKAGE_REGISTRY: $(if [ "$PACKAGE_REGISTRY_HOST" != "" ]; then echo "${PACKAGE_REGISTRY_HOST}/wordpress/wpdev-docker-images"; else echo "wordpressdevelop"; fi) -before_script: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +before_script: + - | + if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + else + echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u "$GITHUB_USERNAME" --password-stdin + fi jobs: include: - stage: "Build base PHP images" name: "php 5.2" script: - - docker build -t wordpressdevelop/php:5.2-fpm 5.2/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG 5.2/php - docker images - - docker push wordpressdevelop/php:5.2-fpm + - docker push $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG - name: "php 5.3" script: - - docker build -t wordpressdevelop/php:5.3-fpm 5.3/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG 5.3/php - docker images - - docker push wordpressdevelop/php:5.3-fpm + - docker push $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG - name: "php 5.4" script: - - docker build -t wordpressdevelop/php:5.4-fpm 5.4/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG 5.4/php - docker images - - docker push wordpressdevelop/php:5.4-fpm + - docker push $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG - name: "php 5.5" script: - - docker build -t wordpressdevelop/php:5.5-fpm 5.5/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG 5.5/php - docker images - - docker push wordpressdevelop/php:5.5-fpm + - docker push $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG - name: "php 5.6" script: - - docker build -t wordpressdevelop/php:5.6-fpm 5.6/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG 5.6/php - docker images - - docker push wordpressdevelop/php:5.6-fpm + - docker push $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG - name: "php 7.0" script: - - docker build -t wordpressdevelop/php:7.0-fpm 7.0/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG 7.0/php - docker images - - docker push wordpressdevelop/php:7.0-fpm + - docker push $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG - name: "php 7.1" script: - - docker build -t wordpressdevelop/php:7.1-fpm 7.1/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG 7.1/php - docker images - - docker push wordpressdevelop/php:7.1-fpm + - docker push $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG - name: "php 7.2" script: - - docker build -t wordpressdevelop/php:7.2-fpm 7.2/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG 7.2/php - docker images - - docker push wordpressdevelop/php:7.2-fpm + - docker push $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG - name: "php 7.3" script: - - docker build -t wordpressdevelop/php:7.3-fpm -t wordpressdevelop/php:latest 7.3/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/php:latest$PR_TAG 7.3/php - docker images - - docker push wordpressdevelop/php:7.3-fpm - - docker push wordpressdevelop/php:latest + - docker push $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG + - docker push $PACKAGE_REGISTRY/php:latest$PR_TAG - name: "php 7.4" script: - - docker build -t wordpressdevelop/php:7.4-fpm 7.4/php + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG 7.4/php - docker images - - docker push wordpressdevelop/php:7.4-fpm + - docker push $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG - stage: "Build child images" name: "phpunit 5.2" script: - - docker build -t wordpressdevelop/phpunit:5.2-fpm 5.2/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.2-fpm$PR_TAG 5.2/phpunit - docker images - - docker push wordpressdevelop/phpunit:5.2-fpm + - docker push $PACKAGE_REGISTRY/phpunit:5.2-fpm$PR_TAG - name: "phpunit 5.3" script: - - docker build -t wordpressdevelop/phpunit:5.3-fpm 5.3/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.3-fpm$PR_TAG 5.3/phpunit - docker images - - docker push wordpressdevelop/phpunit:5.3-fpm + - docker push $PACKAGE_REGISTRY/phpunit:5.3-fpm$PR_TAG - name: "phpunit 5.4" script: - - docker build -t wordpressdevelop/phpunit:5.4-fpm 5.4/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.4-fpm$PR_TAG 5.4/phpunit - docker images - - docker push wordpressdevelop/phpunit:5.4-fpm + - docker push $PACKAGE_REGISTRY/phpunit:5.4-fpm$PR_TAG - name: "phpunit 5.5" script: - - docker build -t wordpressdevelop/phpunit:5.5-fpm 5.5/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.5-fpm$PR_TAG 5.5/phpunit - docker images - - docker push wordpressdevelop/phpunit:5.5-fpm + - docker push $PACKAGE_REGISTRY/phpunit:5.5-fpm$PR_TAG - name: "phpunit 5.6" script: - - docker build -t wordpressdevelop/phpunit:5.6-fpm 5.6/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:5.6-fpm$PR_TAG 5.6/phpunit - docker images - - docker push wordpressdevelop/phpunit:5.6-fpm + - docker push $PACKAGE_REGISTRY/phpunit:5.6-fpm$PR_TAG - name: "phpunit 7.0" script: - - docker build -t wordpressdevelop/phpunit:7.0-fpm 7.0/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.0-fpm$PR_TAG 7.0/phpunit - docker images - - docker push wordpressdevelop/phpunit:7.0-fpm + - docker push $PACKAGE_REGISTRY/phpunit:7.0-fpm$PR_TAG - name: "phpunit 7.1" script: - - docker build -t wordpressdevelop/phpunit:7.1-fpm 7.1/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.1-fpm$PR_TAG 7.1/phpunit - docker images - - docker push wordpressdevelop/phpunit:7.1-fpm + - docker push $PACKAGE_REGISTRY/phpunit:7.1-fpm$PR_TAG - name: "phpunit 7.2" script: - - docker build -t wordpressdevelop/phpunit:7.2-fpm 7.2/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.2-fpm$PR_TAG 7.2/phpunit - docker images - - docker push wordpressdevelop/phpunit:7.2-fpm + - docker push $PACKAGE_REGISTRY/phpunit:7.2-fpm$PR_TAG - name: "phpunit 7.3" script: - - docker build -t wordpressdevelop/phpunit:7.3-fpm -t wordpressdevelop/phpunit:latest 7.3/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/phpunit:latest$PR_TAG 7.3/phpunit - docker images - - docker push wordpressdevelop/phpunit:7.3-fpm - - docker push wordpressdevelop/phpunit:latest + - docker push $PACKAGE_REGISTRY/phpunit:7.3-fpm$PR_TAG + - docker push $PACKAGE_REGISTRY/phpunit:latest$PR_TAG - name: "phpunit 7.4" script: - - docker build -t wordpressdevelop/phpunit:7.4-fpm 7.4/phpunit + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG 7.4/phpunit - docker images - - docker push wordpressdevelop/phpunit:7.4-fpm + - docker push $PACKAGE_REGISTRY/phpunit:7.4-fpm$PR_TAG - name: "cli 5.2" script: - - docker build -t wordpressdevelop/cli:5.2-fpm 5.2/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.2-fpm$PR_TAG 5.2/cli - docker images - - docker push wordpressdevelop/cli:5.2-fpm + - docker push $PACKAGE_REGISTRY/cli:5.2-fpm$PR_TAG - name: "cli 5.3" script: - - docker build -t wordpressdevelop/cli:5.3-fpm 5.3/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.3-fpm$PR_TAG 5.3/cli - docker images - - docker push wordpressdevelop/cli:5.3-fpm + - docker push $PACKAGE_REGISTRY/cli:5.3-fpm$PR_TAG - name: "cli 5.4" script: - - docker build -t wordpressdevelop/cli:5.4-fpm 5.4/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.4-fpm$PR_TAG 5.4/cli - docker images - - docker push wordpressdevelop/cli:5.4-fpm + - docker push $PACKAGE_REGISTRY/cli:5.4-fpm$PR_TAG - name: "cli 5.5" script: - - docker build -t wordpressdevelop/cli:5.5-fpm 5.5/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.5-fpm$PR_TAG 5.5/cli - docker images - - docker push wordpressdevelop/cli:5.5-fpm + - docker push $PACKAGE_REGISTRY/cli:5.5-fpm$PR_TAG - name: "cli 5.6" script: - - docker build -t wordpressdevelop/cli:5.6-fpm 5.6/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:5.6-fpm$PR_TAG 5.6/cli - docker images - - docker push wordpressdevelop/cli:5.6-fpm + - docker push $PACKAGE_REGISTRY/cli:5.6-fpm$PR_TAG - name: "cli 7.0" script: - - docker build -t wordpressdevelop/cli:7.0-fpm 7.0/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.0-fpm$PR_TAG 7.0/cli - docker images - - docker push wordpressdevelop/cli:7.0-fpm + - docker push $PACKAGE_REGISTRY/cli:7.0-fpm$PR_TAG - name: "cli 7.1" script: - - docker build -t wordpressdevelop/cli:7.1-fpm 7.1/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.1-fpm$PR_TAG 7.1/cli - docker images - - docker push wordpressdevelop/cli:7.1-fpm + - docker push $PACKAGE_REGISTRY/cli:7.1-fpm$PR_TAG - name: "cli 7.2" script: - - docker build -t wordpressdevelop/cli:7.2-fpm 7.2/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.2-fpm$PR_TAG 7.2/cli - docker images - - docker push wordpressdevelop/cli:7.2-fpm + - docker push $PACKAGE_REGISTRY/cli:7.2-fpm$PR_TAG - name: "cli 7.3" script: - - docker build -t wordpressdevelop/cli:7.3-fpm -t wordpressdevelop/cli:latest 7.3/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.3-fpm$PR_TAG -t $PACKAGE_REGISTRY/cli:latest$PR_TAG 7.3/cli - docker images - - docker push wordpressdevelop/cli:7.3-fpm - - docker push wordpressdevelop/cli:latest + - docker push $PACKAGE_REGISTRY/cli:7.3-fpm$PR_TAG + - docker push $PACKAGE_REGISTRY/cli:latest$PR_TAG - name: "cli 7.4" script: - - docker build -t wordpressdevelop/cli:7.4-fpm 7.4/cli + - docker build --build-arg PACKAGE_REGISTRY=$PACKAGE_REGISTRY --build-arg PR_TAG=$PR_TAG -t $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG 7.4/cli - docker images - - docker push wordpressdevelop/cli:7.4-fpm + - docker push $PACKAGE_REGISTRY/cli:7.4-fpm$PR_TAG diff --git a/.travis.yml-template b/.travis.yml-template index 2967657..d68a601 100644 --- a/.travis.yml-template +++ b/.travis.yml-template @@ -1,14 +1,33 @@ %%GENERATED_WARNING%% +if: tag IS blank + services: - docker +branches: + only: + - master + env: global: - DOCKER_USERNAME: garypendergast + - GITHUB_USERNAME: pento + # DOCKER_PASSWORD - secure: usv1haWO4zKTM0Ewc/boDRTJTeje6pHYXxBMpf6ny58nvqYlcGfso/UDk6ZlAu/B3/uNrEzf7NqRibJduqmq4RNLqgI7DCFSJuyxXntuSK1/CRJso1+lGYBQKAKoRDb01i1+6qy511LpyZa/nta4FxD0LmrTVNkmurQMQsQIUq5GsSDpbbSmrCZ/oKFQu+mwLnLc1hpbsHdDAjwEiqMW7GGAD5xPmwUa2jV1ZhiKikifggZIpPCnHtKj5a3oGtYVzA9t0TfMkI42Xw089ViZ+7EEmLEG1oGGpZlixZFNE/tgrRF/JmekFYusIOVPEfPEJDMzmGCJwqSanhXxnSHc2OVTJ99CyGXqASKcppRrpxZmBq4j/3tT7aZdXehxoa3+7Ba0wgHqT6n0rJDXq+soZXZZo01hBJxsNKFx9jxkS1EUdKRDCE+sOytfgPFU4nraSjqGOsFQfNYVwW60nMI0Y637k/797SjgZeM6zjXarNpllsaaog3CL+sP+YPKDF9V9CiMUIPi5d5gBBvOts2CKEWgIxuSoukIfjejU4obKC79DOdTGdDYydXRBk4289BY4vtQtr+P7ORMJW1cZ/MFd2Nbxte1OmuE6MoAv2xzutJLJDTNxISC25zI6VdukAtC+F8/HHRzi3ysJO2fr3rH2da6Z8Jep7dSRL4iE0D5S0U= + # GITHUB_TOKEN + - secure: Y8TKVQ9hWYdffxRliIDDDoXCF1FyOeOJ+oq9cRVeMG5/wgofor/3vhN2anOdwrrsoQvmoDwJII97iT9mcKnmQe6UV/LnZXXw/P1peWJOaDsKbwEX+07agNVQKdefqaxi5Jr1wDMgkadn39VU7/haXrsjqJ3Wbnu5AfcGnIzxfVnLjehkuSSOOmQy3w+RwW+HymLVpFqevfhED4uJjrjvwUEvtirxG0E3nyKXGsjusPSDGVzZhmLJBXEHf0g717loN1b+JeUa6TeIYGQ5vM/oRsyzxeJJ0iltiTKk31JHtBP+TTcoyHKWqOzefVfoXCNbk1G2Ez8czUqWIfQK8YnIHOmneUeSi6lQbCdcMSWbv/bJ5+wEJgsQKGBxy7qfF8v0T/GoMSi1OM6JfkcgW3bhuBgMGdnwxJUJ/lmYYAYlmXcO/+cui7lmyXsMT44lArdCZFo9SGt5IlPL4BW5SODYrDFKzP+2uHsj56flK03/lt+/KNJjLZKvH6NbzfhESRzMChnFFaz5eWxHgMZJefO5S51zI/88gu8YZgQDahpgIQUKvZKqi1dSASfVQ7jGqKj3roNKu2s4IdQoMXELeIehrsn9bw6BiN1kaL8yyAXjWLry21VXH0VYv0FdF4W7j23Wv7GWbcg0THDSydLvLYICPBi7NyU3yCPsGGlGpT8Oe9A= + - PR_TAG: $(if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "-$TRAVIS_PULL_REQUEST"; else echo ""; fi) + - PACKAGE_REGISTRY_HOST: $(if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then echo "docker.pkg.github.com"; else echo ""; fi) + - PACKAGE_REGISTRY: $(if [ "$PACKAGE_REGISTRY_HOST" != "" ]; then echo "${PACKAGE_REGISTRY_HOST}/wordpress/wpdev-docker-images"; else echo "wordpressdevelop"; fi) -before_script: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin +before_script: + - | + if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + else + echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u "$GITHUB_USERNAME" --password-stdin + fi jobs: include: diff --git a/5.2/cli/Dockerfile b/5.2/cli/Dockerfile index d3658c2..3a45282 100644 --- a/5.2/cli/Dockerfile +++ b/5.2/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.2-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG ########################################################################## # diff --git a/5.2/phpunit/Dockerfile b/5.2/phpunit/Dockerfile index 69fd079..e0e6dcc 100644 --- a/5.2/phpunit/Dockerfile +++ b/5.2/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.2-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.2-fpm$PR_TAG ########################################################################## # diff --git a/5.3/cli/Dockerfile b/5.3/cli/Dockerfile index 3fe7671..996b66d 100644 --- a/5.3/cli/Dockerfile +++ b/5.3/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.3-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG ########################################################################## # diff --git a/5.3/phpunit/Dockerfile b/5.3/phpunit/Dockerfile index 1627f92..5722f53 100644 --- a/5.3/phpunit/Dockerfile +++ b/5.3/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.3-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.3-fpm$PR_TAG ########################################################################## # diff --git a/5.4/cli/Dockerfile b/5.4/cli/Dockerfile index 91d3f0f..5873d3a 100644 --- a/5.4/cli/Dockerfile +++ b/5.4/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.4-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG ########################################################################## # diff --git a/5.4/phpunit/Dockerfile b/5.4/phpunit/Dockerfile index d140132..228da61 100644 --- a/5.4/phpunit/Dockerfile +++ b/5.4/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.4-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.4-fpm$PR_TAG ########################################################################## # diff --git a/5.5/cli/Dockerfile b/5.5/cli/Dockerfile index 4cf78c5..cd95773 100644 --- a/5.5/cli/Dockerfile +++ b/5.5/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.5-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG ########################################################################## # diff --git a/5.5/phpunit/Dockerfile b/5.5/phpunit/Dockerfile index d33f2c9..1929e47 100644 --- a/5.5/phpunit/Dockerfile +++ b/5.5/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.5-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.5-fpm$PR_TAG ########################################################################## # diff --git a/5.6/cli/Dockerfile b/5.6/cli/Dockerfile index 965cc3e..aa20edd 100644 --- a/5.6/cli/Dockerfile +++ b/5.6/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.6-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG ########################################################################## # diff --git a/5.6/phpunit/Dockerfile b/5.6/phpunit/Dockerfile index 559028f..aa3f600 100644 --- a/5.6/phpunit/Dockerfile +++ b/5.6/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:5.6-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:5.6-fpm$PR_TAG ########################################################################## # diff --git a/7.0/cli/Dockerfile b/7.0/cli/Dockerfile index b0238cf..2db8a09 100644 --- a/7.0/cli/Dockerfile +++ b/7.0/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.0-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG ########################################################################## # diff --git a/7.0/phpunit/Dockerfile b/7.0/phpunit/Dockerfile index afc9d54..980aba4 100644 --- a/7.0/phpunit/Dockerfile +++ b/7.0/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.0-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.0-fpm$PR_TAG ########################################################################## # diff --git a/7.1/cli/Dockerfile b/7.1/cli/Dockerfile index 9f6ac86..aa228c5 100644 --- a/7.1/cli/Dockerfile +++ b/7.1/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.1-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG ########################################################################## # diff --git a/7.1/phpunit/Dockerfile b/7.1/phpunit/Dockerfile index 5e4b901..901c2d3 100644 --- a/7.1/phpunit/Dockerfile +++ b/7.1/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.1-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.1-fpm$PR_TAG ########################################################################## # diff --git a/7.2/cli/Dockerfile b/7.2/cli/Dockerfile index 017f631..6e3c4d3 100644 --- a/7.2/cli/Dockerfile +++ b/7.2/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.2-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG ########################################################################## # diff --git a/7.2/phpunit/Dockerfile b/7.2/phpunit/Dockerfile index b46def1..90dfe7a 100644 --- a/7.2/phpunit/Dockerfile +++ b/7.2/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.2-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.2-fpm$PR_TAG ########################################################################## # diff --git a/7.3/cli/Dockerfile b/7.3/cli/Dockerfile index c0e8f21..1a59ff1 100644 --- a/7.3/cli/Dockerfile +++ b/7.3/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.3-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG ########################################################################## # diff --git a/7.3/phpunit/Dockerfile b/7.3/phpunit/Dockerfile index 245c334..e067bb0 100644 --- a/7.3/phpunit/Dockerfile +++ b/7.3/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.3-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.3-fpm$PR_TAG ########################################################################## # diff --git a/7.4/cli/Dockerfile b/7.4/cli/Dockerfile index e01e02d..78ebaad 100644 --- a/7.4/cli/Dockerfile +++ b/7.4/cli/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.4-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG ########################################################################## # diff --git a/7.4/phpunit/Dockerfile b/7.4/phpunit/Dockerfile index a658020..8c9648d 100644 --- a/7.4/phpunit/Dockerfile +++ b/7.4/phpunit/Dockerfile @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:7.4-fpm +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:7.4-fpm$PR_TAG ########################################################################## # diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..5a77323 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,11 @@ +This project comes under the WordPress [Etiquette](https://wordpress.org/about/etiquette/): + +In the WordPress open source project, we realize that our biggest asset is the community that we foster. The project, as a whole, follows these basic philosophical principles from The Cathedral and The Bazaar. + +- Contributions to the WordPress open source project are for the benefit of the WordPress community as a whole, not specific businesses or individuals. All actions taken as a contributor should be made with the best interests of the community in mind. +- Participation in the WordPress open source project is open to all who wish to join, regardless of ability, skill, financial status, or any other criteria. +- The WordPress open source project is a volunteer-run community. Even in cases where contributors are sponsored by companies, that time is donated for the benefit of the entire open source community. +- Any member of the community can donate their time and contribute to the project in any form including design, code, documentation, community building, etc. For more information, go to make.wordpress.org. +- The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included, by keeping communication free of discrimination, incitement to violence, promotion of hate, and unwelcoming behavior. + +The team involved will block any user who causes any breach in this. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6d8e0d7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,19 @@ +# Contributing + +Thank you for considering contributing to WordPress' development Docker images! If you're unsure of anything, know that you're 💯 welcome to submit an issue or pull request on any topic. The worst that can happen is that you'll be politely directed to the best location to ask your question or to change something in your pull request. We appreciate any sort of contribution and don't want a wall of rules to get in the way of that. + +As with all WordPress projects, we want to ensure a welcoming environment for everyone. With that in mind, all contributors are expected to follow our [Code of Conduct](/CODE_OF_CONDUCT.md). + +All WordPress projects are [licensed under the GPLv2+](/LICENSE), and all contributions to this project will be released under the GPLv2+ license. You maintain copyright over any contribution you make, and by submitting a pull request, you are agreeing to release that contribution under the GPLv2+ license. + +This document covers the technical details around setup, and submitting your contribution to this project. + +## Generating Images + +After modifying any of the Dockerfile template files, you'll need to regenerate them built Dockerfiles. You can do this by running `php update.php`, you should see your changes reflect across all PHP versions. + +## Testing Images + +When submitting a Pull Request, images will be automatically built for you, and hosted on the GitHub Package Registry. As this service is currently in beta, you will need to login to the package registry, even for pulling images. You can read more about this in the [GitHub Package Registry documentation](https://help.github.com/en/articles/configuring-docker-for-use-with-github-package-registry). + +Once Travis finishes building all of these packages, you can modify [`docker-compose.yml`](WordPress/wordpress-develop/tools/local-env/docker-compose.yml) and [`docker-compose.scripts.yml`](WordPress/wordpress-develop/tools/local-env/docker-compose.scripts.yml) to pull from GitHub. For example, the `image` in the PHP container would change from `wordpressdevelop/php:${LOCAL_PHP-latest}` to `docker.pkg.github.com/wordpress/wpdev-docker-images/php:${LOCAL_PHP-latest}-PR_NUMBER`, where `PR_NUMBER` is the number of the Pull Request you submitted. diff --git a/Dockerfile-cli.template b/Dockerfile-cli.template index 0372e6e..04ac9b3 100644 --- a/Dockerfile-cli.template +++ b/Dockerfile-cli.template @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:%%VERSION_TAG%% +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:%%VERSION_TAG%%$PR_TAG %%GENERATED_WARNING%% diff --git a/Dockerfile-phpunit.template b/Dockerfile-phpunit.template index 841c500..93c3823 100644 --- a/Dockerfile-phpunit.template +++ b/Dockerfile-phpunit.template @@ -1,4 +1,6 @@ -FROM wordpressdevelop/php:%%VERSION_TAG%% +ARG PACKAGE_REGISTRY +ARG PR_TAG +FROM $PACKAGE_REGISTRY/php:%%VERSION_TAG%%$PR_TAG %%GENERATED_WARNING%% diff --git a/README.md b/README.md index 190c31c..459f945 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ These Docker images are used by the WordPress Development Environment. -## Updating Images +## Getting Started -- Run `php update.php`. -- Merge the changes to `master`. -- Travis will generate and push the new images to Docker Hub. +- **Download:** These Docker images are built for developing WordPress. You can use them by checking out [the WordPress repository](https://make.wordpress.org/core/handbook/contribute/#the-repositories), and running `npm run env:start`. +- **Discuss:** Conversations and discussions take place in [the #core channel](https://wordpress.slack.com/archives/C02RQBWTW) on the [Making WordPress Slack](https://make.wordpress.org/chat/). +- **Contribute:** Development of these Docker images happens in this GitHub repo. Get started by [reading the contributing guidelines](/CONTRIBUTING.md). diff --git a/update.php b/update.php index 28de9a0..d5fa782 100644 --- a/update.php +++ b/update.php @@ -278,18 +278,19 @@ } // Generate the build and push commands for this image/version. - $build_cmd = "docker build -t wordpressdevelop/$image:$version-fpm"; + $build_cmd = "docker build --build-arg PACKAGE_REGISTRY=\$PACKAGE_REGISTRY --build-arg PR_TAG=\$PR_TAG"; + $build_cmd .= " -t \$PACKAGE_REGISTRY/$image:$version-fpm\$PR_TAG"; if ( $version === $latest ) { - $build_cmd .= " -t wordpressdevelop/$image:latest"; + $build_cmd .= " -t \$PACKAGE_REGISTRY/$image:latest\$PR_TAG"; } $build_cmd_list = array( "$image $version", "$build_cmd $version/$image", 'docker images', - "docker push wordpressdevelop/$image:$version-fpm", + "docker push \$PACKAGE_REGISTRY/$image:$version-fpm\$PR_TAG", ); if ( $version === $latest ) { - $build_cmd_list[] = "docker push wordpressdevelop/$image:latest"; + $build_cmd_list[] = "docker push \$PACKAGE_REGISTRY/$image:latest\$PR_TAG"; } $build_cmds[ $image ][] = $build_cmd_list;