Compare commits

..

9 commits

Author SHA1 Message Date
cbdbf7497b fix: Changes healthcheck to MariaDB compatible syntax
All checks were successful
Build Hello World Image / build (push) Successful in 21s
Build Hello World Image / build (pull_request) Successful in 22s
2025-10-12 00:02:56 +02:00
7875895248 fix: Resolves issue with working directory 2025-10-12 00:02:56 +02:00
cb27186641 fix: CI uses Containerfile and directly tags package 2025-10-12 00:02:56 +02:00
d8830d77aa feat: Adds compose file 2025-10-12 00:02:56 +02:00
41b5ea2ab1 refactor: Replaces PASSWD with PASSWORD 2025-10-12 00:02:56 +02:00
b85516e397 chore: Removes unused example files 2025-10-12 00:02:56 +02:00
93f4ce6145 feat: Adds CI/CD steps to build and push web container 2025-10-12 00:02:56 +02:00
9af7ddc4e2 docs: Replaces on-premise instructions with container instructions 2025-10-12 00:02:56 +02:00
985fbf7600 moved init to utils container 2025-10-11 21:52:41 +02:00
3 changed files with 17 additions and 0 deletions

View file

@ -2,3 +2,4 @@ FROM docker.io/library/php:cli
RUN docker-php-ext-install mysqli bcmath
COPY ./utils/* /opt/
COPY ./data_init/*.sql /opt/init/init.sql

2
create_db.sh Normal file
View file

@ -0,0 +1,2 @@
podman run --network tor -it --env MYSQL_USER=root --env MYSQL_PASSWD=my-secret-pw --env MYSQL_DATABASE=exmple-database --env MARIADB_ROOT_PASSWORD=my-secret-pw -e MYSQL_HOST=some-mariadb -e MYSQL_DB=sunders -e CAMERA_USER=cam -e CAMERA_USER_PASSWD=asdf1234 -e CAMERA_SELECT_USER=cam -e CAMERA_SELECT_USER_PASSWD=asdf1234 localhost/sunders-utils:latest php /opt/create_db.php
podman run --network tor -it --env MYSQL_USER=root --env MYSQL_PASSWD=my-secret-pw --env MYSQL_DATABASE=exmple-database --env MARIADB_ROOT_PASSWORD=my-secret-pw -e MYSQL_HOST=some-mariadb -e MYSQL_DB=sunders -e CAMERA_USER=cam -e CAMERA_USER_PASSWD=asdf1234 -e CAMERA_SELECT_USER=cam -e CAMERA_SELECT_USER_PASSWD=asdf1234 localhost/sunders-data_init:latest

View file

@ -72,5 +72,19 @@ $conn->query("INSERT INTO sync_state (k, v) VALUES ('sequenceNumber', '0');");
echo "Database, users, and tables created successfully.\n";
$result = $conn -> query("SELECT * FROM position limit 10");
$table_count = $result -> num_rows;
printf("Result set has %d rows.\n", $table_count);
if ($table_count == 0){
$location = "/opt/init/init.sql";
$commands = file_get_contents($location);
$conn->multi_query($commands);
echo "Inserted data.\n";
}
$conn->close();
?>