Skip to content
Snippets Groups Projects
Commit 2d0ffca1 authored by Alan Nelson's avatar Alan Nelson
Browse files

Initial commit of PHP and Magento2 containers

parent 5a2c610a
No related branches found
No related tags found
2 merge requests!5Develop,!4Working copy
Showing
with 445 additions and 1 deletion
* text=auto eol=lf
Makefile 0 → 100644
######################################
# Build File for Docker Images #
######################################
.PHONY: magento2-unit-test
all: \
php-lint_5.6 \
php-lint_7.0 \
php-lint_7.1 \
php-lint_7.2 \
php-lint_latest \
magento2-unit-test
# PHP Images
####################
php-lint_5.6:
docker build -t unl-its/php-lint:5.6 php-lint/5.6
php-lint_7.0:
docker build -t unl-its/php-lint:7.0 php-lint/7.0
php-lint_7.1:
docker build -t unl-its/php-lint:7.1 php-lint/7.1
php-lint_7.2:
docker build -t unl-its/php-lint:7.2 php-lint/7.2
php-lint_latest: php-lint_7.2
docker tag unl-its/php-lint:7.2 unl-its/php-lint:latest
# Application Images
####################
magento2-unit-test:
docker build -t unl-its/magento2-unit-test:latest magento2-unit-test/latest
# Cleanup
####################
clean:
docker image rm unl-its/php-lint:5.6; true
docker image rm unl-its/php-lint:7.0; true
docker image rm unl-its/php-lint:7.1; true
docker image rm unl-its/php-lint:7.2; true
docker image rm unl-its/php-lint:latest; true
docker image rm unl-its/magento2-unit-test:latest; true
# docker-ci
Containers used on CI
Containers used on CI
\ No newline at end of file
## Building Images
To build these images, clone this repository onto a machine with docker and make installed. Run `make` and all of the images will be built and installed as local docker images.
FROM centos:7
# Add additional REPOs
RUN rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& rpm -i https://rhel7.iuscommunity.org/ius-release.rpm
# Update system and install required packages
RUN yum update -y \
&& yum install -y \
unzip \
php71u-cli \
php71u-json \
php71u-pdo \
php71u-mysqlnd \
php71u-opcache \
php71u-xml \
php71u-mcrypt \
php71u-gd \
php71u-devel \
php71u-intl \
php71u-mbstring \
php71u-bcmath \
php71u-json \
php71u-soap \
&& yum clean all \
&& rm -rf /var/cache/yum
# Install composer
RUN curl -o /usr/local/bin/composer https://getcomposer.org/composer.phar \
&& chmod 755 /usr/local/bin/composer
# PHP Config file
COPY php.ini /etc/php.d/mg2.ini
# Custom Scrips
COPY set-mg2-credentials /usr/local/bin/set-mg2-credentials
RUN chmod 755 /usr/local/bin/set-mg2-credentials
CMD ["bash"]
memory_limit = 2G
session.auto_start = off;
date.timezone="America/Chicago"
#!/bin/bash
if [[ "$#" -ne 2 ]]; then
echo "Please provide both the username and password"
exit 1
fi
mkdir -p /root/.composer
cat > /root/.composer/auth.json <<EOF
{
"http-basic": {
"repo.magento.com": {
"username": "$1",
"password": "$2"
}
}
}
EOF
FROM php:5.6-alpine
RUN apk add --no-cache bash
COPY php-lint docker-entrypoint /usr/local/bin/
RUN chmod 755 /usr/local/bin/docker-entrypoint /usr/local/bin/php-lint
ENTRYPOINT ["docker-entrypoint"]
CMD ["--help"]
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
FROM php:7.0-alpine
RUN apk add --no-cache bash
COPY php-lint docker-entrypoint /usr/local/bin/
RUN chmod 755 /usr/local/bin/docker-entrypoint /usr/local/bin/php-lint
ENTRYPOINT ["docker-entrypoint"]
CMD ["--help"]
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
FROM php:7.1-alpine
RUN apk add --no-cache bash
COPY php-lint docker-entrypoint /usr/local/bin/
RUN chmod 755 /usr/local/bin/docker-entrypoint /usr/local/bin/php-lint
ENTRYPOINT ["docker-entrypoint"]
CMD ["--help"]
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
FROM php:7.2-alpine
RUN apk add --no-cache bash
COPY php-lint docker-entrypoint /usr/local/bin/
RUN chmod 755 /usr/local/bin/docker-entrypoint /usr/local/bin/php-lint
ENTRYPOINT ["docker-entrypoint"]
CMD ["--help"]
#!/bin/bash
set -e
if [ "${1#-}" != "$1" ]; then
set -- php-lint "$@"
fi
exec "$@"
#!/bin/bash
# Read CLI options
LINT_DIRS=()
LINT_EXTS=()
QUIET=false
while [[ $# -gt 0 ]]; do
case $1 in
-e|--ext)
LINT_EXTS+=("$2")
shift
shift
;;
-d|--dir)
LINT_DIRS+=("$2")
shift
shift
;;
-q|--quiet)
QUIET=true
shift
;;
-h|--help)
printf 'Usage: %s <options>\n' "$0"
printf '\t%s\n' "-e,--ext: Required argument: extensions to lint"
printf '\t%s\n' "-d,--dir: Required argument: directories to lint"
printf '\t%s\n' "-q,--quiet: Optional argument: Quiet mode, only print errors"
printf '\t%s\n' "-h,--help: Prints this help message"
exit 0
;;
*)
echo "Unrecognized option ${1}"
shift
;;
esac
done
# If no dirs were provided, use CWD
if [[ -z "$LINT_DIRS" ]]; then
LINT_DIRS=($(pwd))
fi
# If no extenions were provided, use reasonable defaults
if [[ -z "$LINT_EXTS" ]]; then
LINT_EXTS=(".php" ".phtml")
fi
# Run PHP Lint on all provided files and directories
for dir in "${LINT_DIRS[@]}"; do
for ext in "${LINT_EXTS[@]}"; do
echo "Scanning directory ${dir} for extension ${ext}"
# Scan current dir and ext and lint them
for f in $(find "${dir}" -type f -name "*${ext}"); do
OUTPUT=$(php -l $f 2>&1)
rc=$?
if [[ $rc != 0 ]]; then # Non-zero exit code, print error and exit
>&2 echo "$OUTPUT"
exit $rc
elif [[ $rc == 0 ]] && [[ $QUIET == false ]]; then # all ok
echo "$OUTPUT"
fi
done
done
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment