From f415d66c3e9e6bcf3ecfb3148d1523da54410dfc Mon Sep 17 00:00:00 2001 From: Alan Nelson <alan.nelson@nebraska.edu> Date: Wed, 23 Jan 2019 16:47:06 -0600 Subject: [PATCH] Add php-unit-test images and Vagrant template --- .gitignore | 3 +++ Makefile | 48 ++++++++++++++++++++++++++---------- Vagrantfile.example | 36 +++++++++++++++++++++++++++ php-unit-test/5.6/Dockerfile | 19 ++++++++++++++ php-unit-test/7.0/Dockerfile | 19 ++++++++++++++ php-unit-test/7.1/Dockerfile | 19 ++++++++++++++ php-unit-test/7.2/Dockerfile | 19 ++++++++++++++ 7 files changed, 150 insertions(+), 13 deletions(-) create mode 100644 .gitignore create mode 100644 Vagrantfile.example create mode 100644 php-unit-test/5.6/Dockerfile create mode 100644 php-unit-test/7.0/Dockerfile create mode 100644 php-unit-test/7.1/Dockerfile create mode 100644 php-unit-test/7.2/Dockerfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c11ebb4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Vagrant +.vagrant/ +Vagrantfile \ No newline at end of file diff --git a/Makefile b/Makefile index e3ca46a..7d73fee 100644 --- a/Makefile +++ b/Makefile @@ -21,42 +21,64 @@ BUILD_ARGS := --build-arg VCS_REF=$(GIT_COMMIT) .PHONY: all clean test $(DOCKERFILES) clean_images $(IMAGES_TO_CLEAN) static-code-analysis delete_dangling_images security -all: \ - php-lint_5.6 php-lint_7.0 php-lint_7.1 php-lint_7.2 php-lint_latest \ - magento2-unit-test magento2-xml-lint \ - static-code-analysis +all: php-lint php-unit-test magento2 static-code-analysis -# PHP Images +# Image Groups +#################### +php-lint: php-lint_5.6 php-lint_7.0 php-lint_7.1 php-lint_7.2 php-lint_latest +php-unit-test: php-unit-test_5.6 php-unit-test_7.0 php-unit-test_7.1 php-unit-test_7.2 php-unit-test_latest +magento2: magento2-unit-test magento2-xml-lint +static-code-analysis: static-code-analysis_latest static-code-analysys_php static-code-analysys_python + +# PHP Lint Images #################### php-lint_5.6: php-lint/5.6/Dockerfile - docker build -t unl-its/php-lint:5.6 -f php-lint/5.6/Dockerfile php-lint + docker build $(BUILD_ARGS) -t unl-its/php-lint:5.6 -f php-lint/5.6/Dockerfile php-lint php-lint_7.0: php-lint/7.0/Dockerfile - docker build -t unl-its/php-lint:7.0 -f php-lint/7.0/Dockerfile php-lint + docker build $(BUILD_ARGS) -t unl-its/php-lint:7.0 -f php-lint/7.0/Dockerfile php-lint php-lint_7.1: php-lint/7.1/Dockerfile - docker build -t unl-its/php-lint:7.1 -f php-lint/7.1/Dockerfile php-lint + docker build $(BUILD_ARGS) -t unl-its/php-lint:7.1 -f php-lint/7.1/Dockerfile php-lint php-lint_7.2: php-lint/7.2/Dockerfile - docker build -t unl-its/php-lint:7.2 -f php-lint/7.2/Dockerfile php-lint + docker build $(BUILD_ARGS) -t unl-its/php-lint:7.2 -f php-lint/7.2/Dockerfile php-lint php-lint_latest: php-lint_7.2 docker tag unl-its/php-lint:7.2 unl-its/php-lint:latest +# PHP Unit Test Images +#################### +php-unit-test_5.6: php-unit-test/5.6/Dockerfile + docker build $(BUILD_ARGS) -t unl-its/php-unit-test:5.6 -f php-unit-test/5.6/Dockerfile php-unit-test + +php-unit-test_7.0: php-unit-test/7.0/Dockerfile + docker build $(BUILD_ARGS) -t unl-its/php-unit-test:7.0 -f php-unit-test/7.0/Dockerfile php-unit-test + +php-unit-test_7.1: php-unit-test/7.1/Dockerfile + docker build $(BUILD_ARGS) -t unl-its/php-unit-test:7.1 -f php-unit-test/7.1/Dockerfile php-unit-test + +php-unit-test_7.2: php-unit-test/7.2/Dockerfile + docker build $(BUILD_ARGS) -t unl-its/php-unit-test:7.2 -f php-unit-test/7.2/Dockerfile php-unit-test + +php-unit-test_latest: php-unit-test_7.2 + docker tag unl-its/php-unit-test:7.2 unl-its/php-unit-test:latest # Application Images #################### magento2-unit-test: magento2-unit-test/latest/Dockerfile - docker build -t unl-its/magento2-unit-test:latest magento2-unit-test/latest + docker build $(BUILD_ARGS) -t unl-its/magento2-unit-test:latest magento2-unit-test/latest magento2-xml-lint: magento2-unit-test magento2-xml-lint/latest/Dockerfile - docker build -t unl-its/magento2-xml-lint:latest magento2-xml-lint/latest + docker build $(BUILD_ARGS) -t unl-its/magento2-xml-lint:latest magento2-xml-lint/latest # Sonarqube static-code-analysis # ##################### -static-code-analysis: +static-code-analysis_latest: static-code-analysis/Dockerfile docker build $(BUILD_ARGS) -t unl-its/static-code-analysis:latest static-code-analysis/ +static-code-analysys_php: static-code-analysis/Dockerfile docker build $(BUILD_ARGS) -t unl-its/static-code-analysis:php static-code-analysis/ +static-code-analysys_python: static-code-analysis/Dockerfile docker build $(BUILD_ARGS) -t unl-its/static-code-analysis:python static-code-analysis/ # Cleanup @@ -65,7 +87,7 @@ clean: clean_images test: $(DOCKERFILES) $(DOCKERFILES): - @echo "Linting and validating $(@D)..." + @echo "Linting and validating $(@D)..." @docker run --rm -i nimmis/label-inspector lint < $(@D)/Dockerfile @docker run --rm -i nimmis/label-inspector validate < $(@D)/Dockerfile diff --git a/Vagrantfile.example b/Vagrantfile.example new file mode 100644 index 0000000..83221cd --- /dev/null +++ b/Vagrantfile.example @@ -0,0 +1,36 @@ +vm_name = "docker-ci" + +Vagrant.configure(2) do |config| + +# --- UNL Linux VM configuration ------------------------- + config.vm.box = "centos/7" + config.vm.hostname = vm_name + config.vm.box_check_update = true + config.vbguest.auto_update = false + + config.vm.network "private_network", ip: "192.168.100.101" + config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['vers=3', :udp, :nolock, :noatime, :rw] + + # virtualbox VM settings + config.vm.provider "virtualbox" do |vb| + vb.linked_clone = true + vb.name = vm_name + vb.memory = "512" + vb.cpus = "1" + end +# -------------------------------------------------------------------- + + +# --- Inline provisioning ---------------------------------- + config.vm.provision "shell", inline: <<-SHELL + yum update -y + sudo yum install -y make docker git + + systemctl enable docker + systemctl start docker + + chmod o+rw /var/run/docker.sock + SHELL +# -------------------------------------------------------------------- + +end diff --git a/php-unit-test/5.6/Dockerfile b/php-unit-test/5.6/Dockerfile new file mode 100644 index 0000000..7de97f9 --- /dev/null +++ b/php-unit-test/5.6/Dockerfile @@ -0,0 +1,19 @@ +FROM php:5.6-alpine + +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="PHP 5.6 Unit Tester" \ + org.label-schema.description="" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vendor="University of Nebraska - Lincoln" \ + org.label-schema.version=$VERSION \ + org.label-schema.schema-version="1.0" \ + maintainer="Alan Nelson <alan.nelson@nebraska.edu>" + +RUN apk add --no-cache bash nodejs nodejs-npm +RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar \ + && chmod 755 /usr/local/bin/composer + +CMD ["bash"] diff --git a/php-unit-test/7.0/Dockerfile b/php-unit-test/7.0/Dockerfile new file mode 100644 index 0000000..1fcfeb7 --- /dev/null +++ b/php-unit-test/7.0/Dockerfile @@ -0,0 +1,19 @@ +FROM php:7.0-alpine + +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="PHP 5.6 Unit Tester" \ + org.label-schema.description="" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vendor="University of Nebraska - Lincoln" \ + org.label-schema.version=$VERSION \ + org.label-schema.schema-version="1.0" \ + maintainer="Alan Nelson <alan.nelson@nebraska.edu>" + +RUN apk add --no-cache bash nodejs nodejs-npm +RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar \ + && chmod 755 /usr/local/bin/composer + +CMD ["bash"] diff --git a/php-unit-test/7.1/Dockerfile b/php-unit-test/7.1/Dockerfile new file mode 100644 index 0000000..cc21add --- /dev/null +++ b/php-unit-test/7.1/Dockerfile @@ -0,0 +1,19 @@ +FROM php:7.1-alpine + +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="PHP 5.6 Unit Tester" \ + org.label-schema.description="" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vendor="University of Nebraska - Lincoln" \ + org.label-schema.version=$VERSION \ + org.label-schema.schema-version="1.0" \ + maintainer="Alan Nelson <alan.nelson@nebraska.edu>" + +RUN apk add --no-cache bash nodejs nodejs-npm +RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar \ + && chmod 755 /usr/local/bin/composer + +CMD ["bash"] diff --git a/php-unit-test/7.2/Dockerfile b/php-unit-test/7.2/Dockerfile new file mode 100644 index 0000000..4c419aa --- /dev/null +++ b/php-unit-test/7.2/Dockerfile @@ -0,0 +1,19 @@ +FROM php:7.2-alpine + +ARG BUILD_DATE +ARG VCS_REF +ARG VERSION +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name="PHP 5.6 Unit Tester" \ + org.label-schema.description="" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vendor="University of Nebraska - Lincoln" \ + org.label-schema.version=$VERSION \ + org.label-schema.schema-version="1.0" \ + maintainer="Alan Nelson <alan.nelson@nebraska.edu>" + +RUN apk add --no-cache bash nodejs nodejs-npm +RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar \ + && chmod 755 /usr/local/bin/composer + +CMD ["bash"] -- GitLab