add debian 7
This commit is contained in:
parent
8a7e81e00f
commit
febcabce43
4 changed files with 81 additions and 0 deletions
10
docker/debian7/Dockerfile
Normal file
10
docker/debian7/Dockerfile
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
FROM debian:7
|
||||
|
||||
ADD packages.sh /usr/sbin/docker-packages
|
||||
RUN docker-packages
|
||||
|
||||
ADD install.sh /usr/sbin/docker-install
|
||||
RUN docker-install
|
||||
|
||||
ADD run.sh /usr/sbin/docker-run
|
||||
CMD docker-run
|
||||
24
docker/debian7/install.sh
Executable file
24
docker/debian7/install.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# install software
|
||||
cd /root; git clone https://github.com/mevdschee/php-crud-api.git
|
||||
# download phpunit 4.8 for PHP < 5.6
|
||||
cd php-crud-api; wget https://phar.phpunit.de/phpunit-4.8.phar -O phpunit.phar
|
||||
# copy dist config to config
|
||||
cp tests/Config.php.dist tests/Config.php
|
||||
# replace variables
|
||||
sed -i 's/{{mysql_hostname}}/localhost/g' tests/Config.php
|
||||
sed -i 's/{{mysql_username}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{mysql_password}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{mysql_database}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{pgsql_hostname}}/localhost/g' tests/Config.php
|
||||
sed -i 's/{{pgsql_username}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{pgsql_password}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{pgsql_database}}/php-crud-api/g' tests/Config.php
|
||||
sed -i 's/{{sqlite_hostname}}//g' tests/Config.php
|
||||
sed -i 's/{{sqlite_username}}//g' tests/Config.php
|
||||
sed -i 's/{{sqlite_password}}//g' tests/Config.php
|
||||
sed -i 's/{{sqlite_database}}/tests\/sqlite.db/g' tests/Config.php
|
||||
# move comments
|
||||
sed -i 's/\/\* Uncomment/\/\/ Uncomment/g' tests/Config.php
|
||||
sed -i "s/'SQLServer'/\/\* 'SQLServer'/g" tests/Config.php
|
||||
13
docker/debian7/packages.sh
Executable file
13
docker/debian7/packages.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ensure noninteractive is enabled for apt
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
# update (upgrade should not be needed)
|
||||
apt-get -y update # && apt-get -y upgrade
|
||||
# install: php / mysql / postgres / sqlite / tools
|
||||
apt-get -y install \
|
||||
php5-cli \
|
||||
mysql-server mysql-client php5-mysql \
|
||||
postgresql php5-pgsql \
|
||||
sqlite php5-sqlite \
|
||||
git wget
|
||||
34
docker/debian7/run.sh
Executable file
34
docker/debian7/run.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# run mysql server
|
||||
nohup mysqld > /root/mysql.log 2>&1 &
|
||||
# wait for mysql to become available
|
||||
while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
# create database and user on mysql
|
||||
mysql -u root >/dev/null << 'EOF'
|
||||
CREATE DATABASE `php-crud-api` CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
CREATE USER 'php-crud-api'@'localhost' IDENTIFIED BY 'php-crud-api';
|
||||
GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
EOF
|
||||
|
||||
# run postgres server
|
||||
nohup su - -c "/usr/lib/postgresql/9.1/bin/postgres -D /etc/postgresql/9.1/main" postgres > /root/postgres.log 2>&1 &
|
||||
# wait for postgres to become available
|
||||
until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
|
||||
sleep 1;
|
||||
done
|
||||
# create database and user on postgres
|
||||
su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
|
||||
CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
|
||||
CREATE DATABASE "php-crud-api";
|
||||
GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
|
||||
\q
|
||||
EOF
|
||||
|
||||
# run the tests
|
||||
cd /root/php-crud-api
|
||||
git pull
|
||||
php phpunit.phar
|
||||
Loading…
Add table
Add a link
Reference in a new issue