Skip to content

Commit 3773e02

Browse files
committed
Update ubuntu php (#188)
* update docker compose for ubuntu 24.04, php8.3 * fix startup order
1 parent 2d9ba1e commit 3773e02

File tree

7 files changed

+63
-30
lines changed

7 files changed

+63
-30
lines changed

tools/docker-dev/build.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
2-
2+
set -e
33
cd "$(dirname "$0")"
4-
54
docker-compose down
6-
docker-compose build --no-cache
7-
docker image prune
5+
docker-compose build
6+
docker image prune

tools/docker-dev/docker-compose.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,51 @@
1-
version: "3.9"
1+
networks:
2+
default:
3+
name: unity_dev_network
24
services:
35
identity:
46
hostname: identity
57
build: identity
68
ports:
79
- "8010:80"
8-
web:
9-
hostname: web
10-
build: web
11-
ports:
12-
- "8000:80"
13-
volumes:
14-
- ../../:/var/www/unity-web-portal
10+
- "389:389"
11+
healthcheck:
12+
test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 389 && touch /tmp/up); else true; fi"]
13+
interval: 1s
1514
sql:
1615
hostname: sql
1716
build: sql
1817
ports:
1918
- "8020:80"
19+
- "3306:3306"
20+
healthcheck:
21+
test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 3306 && touch /tmp/up); else true; fi"]
22+
interval: 1s
2023
smtp:
2124
hostname: smtp
2225
image: schickling/mailcatcher
2326
ports:
2427
- "8030:1080"
2528
redis:
2629
hostname: redis
27-
image: redis
28-
networks:
29-
default:
30-
name: unity_dev_network
30+
build: redis
31+
ports:
32+
- "6379:6379"
33+
healthcheck:
34+
test: ["CMD-SHELL", "if [ -f /tmp/up ]; then (nc -z localhost 6379 && touch /tmp/up); else true; fi"]
35+
interval: 1s
36+
web:
37+
hostname: web
38+
build: web
39+
ports:
40+
- "8000:80"
41+
volumes:
42+
- ../../:/var/www/unity-web-portal
43+
depends_on:
44+
identity:
45+
condition: service_healthy
46+
sql:
47+
condition: service_healthy
48+
smtp:
49+
condition: service_started
50+
redis:
51+
condition: service_healthy

tools/docker-dev/identity/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
22

33
# OpenLDAP Server
44
ARG DEBIAN_FRONTEND=noninteractive
55
RUN apt-get update && apt-get install -y \
66
slapd \
77
ldap-utils \
88
apache2 \
9-
phpldapadmin
9+
phpldapadmin \
10+
netcat-openbsd
1011
RUN rm -rf /var/lib/ldap
1112
RUN mkdir /var/lib/ldap
1213
RUN chown openldap:openldap /var/lib/ldap
@@ -32,8 +33,9 @@ COPY phpldapadmin-apache.conf /etc/apache2/sites-available/phpldapadmin.conf
3233
RUN a2dissite 000-default
3334
RUN a2ensite phpldapadmin
3435
RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf
36+
RUN sed -i '/memory_limit/c\memory_limit = -1' /etc/php/8.3/apache2/php.ini
3537

3638
EXPOSE 80
3739
EXPOSE 389
3840

39-
CMD apache2ctl -D FOREGROUND & slapd -h "ldap:/// ldapi:///" -u openldap -g openldap -d 0
41+
CMD apache2ctl -D FOREGROUND & slapd -h "ldap:/// ldapi:///" -u openldap -g openldap -d 0

tools/docker-dev/redis/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM redis
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y netcat-openbsd

tools/docker-dev/run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
2+
set -e
33
cd "$(dirname "$0")"
4-
5-
docker-compose up
4+
docker-compose up

tools/docker-dev/sql/Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
44
RUN apt-get update && apt-get install -y \
55
mariadb-server \
66
mariadb-client \
77
apache2 \
8-
phpmyadmin
8+
php8.3 \
9+
phpmyadmin \
10+
netcat-openbsd
911
RUN sed -i '/bind-address/c\bind-address = 0.0.0.0' /etc/mysql/mariadb.conf.d/50-server.cnf
1012
COPY bootstrap.sql /tmp/bootstrap.sql
1113

12-
RUN service mysql start; \
14+
RUN service mariadb start; \
1315
mariadb -e "CREATE DATABASE unity"; \
1416
mariadb -e "CREATE USER 'unity'@'%' IDENTIFIED BY 'password'"; \
1517
mariadb -e "GRANT ALL PRIVILEGES ON unity.* TO 'unity'@'%'"; \
@@ -28,4 +30,4 @@ RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf
2830
EXPOSE 80
2931
EXPOSE 3306
3032

31-
CMD apache2ctl -D FOREGROUND & mysqld
33+
CMD apache2ctl -D FOREGROUND & mysqld --user=root

tools/docker-dev/web/Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:24.04
22

33
# Web Server Setup
44
ARG DEBIAN_FRONTEND=noninteractive
@@ -12,16 +12,22 @@ RUN apt-get update && apt-get install -y \
1212
php-ldap \
1313
php-pdo \
1414
php-redis \
15-
php-cli
15+
php-cli \
16+
php-mbstring \
17+
php-xml
1618
COPY htpasswd /etc/apache2/.htpasswd
19+
RUN chown www-data /etc/apache2/.htpasswd
1720
COPY unity-apache.conf /etc/apache2/sites-available/unity.conf
1821
RUN a2dissite 000-default
1922
RUN a2ensite unity
2023
RUN echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf
2124

22-
RUN sed -i '/display_errors/c\display_errors = on' /etc/php/7.4/apache2/php.ini
25+
RUN sed -i '/display_errors/c\display_errors = on' /etc/php/8.3/apache2/php.ini
26+
RUN sed -i '/zend.assertions/c\zend.assertions = 1' /etc/php/8.3/apache2/php.ini
27+
RUN sed -i '/zend.assertions/c\zend.assertions = 1' /etc/php/8.3/cli/php.ini
28+
RUN sed -i '/memory_limit/c\memory_limit = -1' /etc/php/8.3/apache2/php.ini
2329

2430
# Start apache2 server
2531
EXPOSE 80
2632

27-
CMD ["apache2ctl", "-D", "FOREGROUND"]
33+
CMD ["bash", "-c", "pushd /var/www/unity-web-portal/workers >/dev/null && echo 'updating LDAP cache...' && php ./update-ldap-cache.php && popd >/dev/null && apache2ctl -D FOREGROUND"]

0 commit comments

Comments
 (0)