Browse Source

add debian 10

Maurits van der Schee 4 years ago
parent
commit
d900aa2f46
2 changed files with 73 additions and 0 deletions
  1. 15
    0
      docker/debian10/Dockerfile
  2. 58
    0
      docker/debian10/run.sh

+ 15
- 0
docker/debian10/Dockerfile View File

@@ -0,0 +1,15 @@
1
+FROM debian:10
2
+
3
+ARG DEBIAN_FRONTEND=noninteractive
4
+
5
+# install: php / mysql / postgres / tools / mssql deps
6
+RUN apt-get update && apt-get -y install \
7
+php-cli php-xml \
8
+mariadb-server mariadb-client php-mysql \
9
+postgresql php-pgsql \
10
+postgresql-11-postgis-2.5 \
11
+git wget
12
+
13
+# install run script
14
+ADD run.sh /usr/sbin/docker-run
15
+CMD docker-run

+ 58
- 0
docker/debian10/run.sh View File

@@ -0,0 +1,58 @@
1
+#!/bin/bash
2
+echo "================================================"
3
+echo " Debian 10 (PHP 7.3)"
4
+echo "================================================"
5
+
6
+echo -n "[1/4] Starting MariaDB 10.3 ..... "
7
+# make sure mysql can create socket and lock
8
+mkdir /var/run/mysqld && chmod 777 /var/run/mysqld
9
+# run mysql server
10
+nohup mysqld > /root/mysql.log 2>&1 &
11
+# wait for mysql to become available
12
+while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
13
+    sleep 1
14
+done
15
+# create database and user on mysql
16
+mysql -u root >/dev/null << 'EOF'
17
+CREATE DATABASE `php-crud-api` CHARACTER SET utf8 COLLATE utf8_general_ci;
18
+CREATE USER 'php-crud-api'@'localhost' IDENTIFIED BY 'php-crud-api';
19
+GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
20
+FLUSH PRIVILEGES;
21
+EOF
22
+echo "done"
23
+
24
+echo -n "[2/4] Starting PostgreSQL 11.4 .. "
25
+# run postgres server
26
+nohup su - -c "/usr/lib/postgresql/11/bin/postgres -D /etc/postgresql/11/main" postgres > /root/postgres.log 2>&1 &
27
+# wait for postgres to become available
28
+until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
29
+   sleep 1;
30
+done
31
+# create database and user on postgres
32
+su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
33
+CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
34
+CREATE DATABASE "php-crud-api";
35
+GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
36
+\c "php-crud-api";
37
+CREATE EXTENSION IF NOT EXISTS postgis;
38
+\q
39
+EOF
40
+echo "done"
41
+
42
+echo -n "[3/4] Starting SQLServer 2017 ... "
43
+echo "skipped"
44
+
45
+echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
46
+# install software
47
+if [ -d /php-crud-api ]; then
48
+  echo "skipped"
49
+else
50
+  git clone --quiet https://github.com/mevdschee/php-crud-api.git
51
+  echo "done"
52
+fi
53
+
54
+echo "------------------------------------------------"
55
+
56
+# run the tests
57
+cd php-crud-api
58
+php test.php

Loading…
Cancel
Save