Skip to content

Commit 21fdc71

Browse files
committed
add Ubuntu 24.04
1 parent df66135 commit 21fdc71

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

docker/ubuntu24/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM ubuntu:24.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
# install: php / mysql / postgres / sqlite / tools / mssql deps
6+
RUN apt-get update && apt-get -y install \
7+
php-cli php-xml php-mbstring \
8+
mysql-server mysql-client php-mysql \
9+
postgresql php-pgsql \
10+
postgresql-16-postgis-3 \
11+
sqlite3 php-sqlite3 \
12+
git wget \
13+
curl gnupg
14+
15+
# install locales
16+
RUN apt-get -y install locales
17+
RUN locale-gen en_US.UTF-8
18+
RUN update-locale LANG=en_US.UTF-8
19+
20+
# install run script
21+
ADD run.sh /usr/sbin/docker-run
22+
CMD docker-run

docker/ubuntu24/run.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
echo "================================================"
3+
echo " Ubuntu 24.04 (PHP 8.3)"
4+
echo "================================================"
5+
6+
echo -n "[1/4] Starting MySQL 8. ........ "
7+
# run mysql server
8+
nohup mysqld > /root/mysql.log 2>&1 &
9+
# wait for mysql to become available
10+
while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
11+
sleep 1
12+
done
13+
# create database and user on mysql
14+
mysql -u root >/dev/null << 'EOF'
15+
CREATE DATABASE `php-crud-api` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
16+
CREATE USER 'php-crud-api'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'php-crud-api';
17+
GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
18+
FLUSH PRIVILEGES;
19+
EOF
20+
echo "done"
21+
22+
echo -n "[2/4] Starting PostgreSQL 16.2 .. "
23+
# ensure statistics can be written
24+
mkdir /var/run/postgresql/10-main.pg_stat_tmp/ && chmod 777 /var/run/postgresql/10-main.pg_stat_tmp/
25+
# run postgres server
26+
nohup su - -c "/usr/lib/postgresql/16/bin/postgres -D /etc/postgresql/16/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+
ALTER DATABASE "php-crud-api" OWNER TO "php-crud-api";
36+
GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
37+
\c "php-crud-api";
38+
CREATE EXTENSION IF NOT EXISTS postgis;
39+
\q
40+
EOF
41+
echo "done"
42+
43+
echo -n "[3/4] Starting SQLServer 2019 ... "
44+
echo "skipped"
45+
46+
echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
47+
# install software
48+
if [ -d /php-crud-api ]; then
49+
echo "skipped"
50+
else
51+
git clone --quiet https://github.com/mevdschee/php-crud-api.git
52+
echo "done"
53+
fi
54+
55+
echo "------------------------------------------------"
56+
57+
# run the tests
58+
cd php-crud-api
59+
php test.php

tests/fixtures/create_pgsql.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ DROP USER "php-crud-api";
55
--
66
CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
77
CREATE DATABASE "php-crud-api";
8+
ALTER DATABASE "php-crud-api" OWNER TO "php-crud-api";
89
GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
910
\c "php-crud-api";
1011
CREATE EXTENSION IF NOT EXISTS postgis;

0 commit comments

Comments
 (0)