diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c11ebb4b81ebef3815bc194d5a2f17c5fe1f81ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Vagrant +.vagrant/ +Vagrantfile \ No newline at end of file diff --git a/Makefile b/Makefile index e3ca46a6815af4deac24c5b4e2d154de165e5c0b..7d73feee4a90ada7c500ce89f127279f750cf617 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 0000000000000000000000000000000000000000..83221cd9fa9b6484f5d3f3ead67029c6fca008d9 --- /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 0000000000000000000000000000000000000000..7de97f93f2c2f69b7e96191cc24862fc1818e7e5 --- /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 0000000000000000000000000000000000000000..1fcfeb735bfb84042b98cdc4abfbbe3bc186183f --- /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 0000000000000000000000000000000000000000..cc21add2d2d34ba71298087253febb7e641338ab --- /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 0000000000000000000000000000000000000000..4c419aab187158b5c0d353bcd4dfbc14efba57a1 --- /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"]