diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..775104b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM php:8.0-apache + +WORKDIR /var/www/html + +RUN apt update -y && apt install -y libmariadb-dev + +RUN docker-php-ext-install mysqli \ No newline at end of file diff --git a/strona_praktyka.sql b/database/strona_praktyka.sql similarity index 100% rename from strona_praktyka.sql rename to database/strona_praktyka.sql diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b1d6e8a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: '1.2' + +services: + php-env: + build: . + volumes: + - .:/var/www/html + ports: + - 2137:80 + + mysql_db: + image: mysql:latest + command: --default-authentication-plugin=mysql_native_password + restart: always + volumes: + - ./database:/home + environment: + MYSQL_ROOT_PASSWORD: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + + phpmyadmin: + image: phpmyadmin:latest + restart: always + ports: + - 7312:80 + environment: + - PMA_ARBITRARY=1 \ No newline at end of file diff --git a/kod/about.php b/kod/about.php index cf05b39..91180a9 100644 --- a/kod/about.php +++ b/kod/about.php @@ -24,7 +24,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -40,7 +40,7 @@ ?> - + @@ -85,7 +85,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/kod/album_bootleg_princess.php b/kod/album_bootleg_princess.php index a86266a..6a0f540 100644 --- a/kod/album_bootleg_princess.php +++ b/kod/album_bootleg_princess.php @@ -22,7 +22,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -57,7 +57,7 @@
connect_error) { die("Connection failed " . $link->connect_error); @@ -90,7 +90,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/kod/album_undefined.php b/kod/album_undefined.php index 9589fb6..d9d957e 100644 --- a/kod/album_undefined.php +++ b/kod/album_undefined.php @@ -22,7 +22,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -57,7 +57,7 @@
connect_error) { die("Connection failed " . $link->connect_error); @@ -90,7 +90,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/kod/album_vogue_society.php b/kod/album_vogue_society.php index 8cdf81d..561fc54 100644 --- a/kod/album_vogue_society.php +++ b/kod/album_vogue_society.php @@ -22,7 +22,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -57,7 +57,7 @@
connect_error) { die("Connection failed " . $link->connect_error); @@ -90,7 +90,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/kod/albumy.php b/kod/albumy.php index 75aa816..750e3a8 100644 --- a/kod/albumy.php +++ b/kod/albumy.php @@ -24,7 +24,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -40,7 +40,7 @@ ?> - + @@ -59,7 +59,7 @@
connect_error) { die("Connection failed: " . $link->connect_error); @@ -94,7 +94,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/kod/index.php b/kod/index.php index 9edbd8b..ef3ec4b 100644 --- a/kod/index.php +++ b/kod/index.php @@ -25,7 +25,7 @@ connect_error) { die("Connection failed: " . $link->connect_error); @@ -80,7 +80,7 @@ $tab = array(); - $link = new mysqli("localhost", "root", ""); + $link = new mysqli("mysql_db", "root", ""); if ($link->connect_error) { die("Connection failed: " . $link->connect_error); @@ -127,7 +127,7 @@
Kapcioszek
connect_error) { die("Connection failed: " . $link->connect_error); diff --git a/run-container.sh b/run-container.sh new file mode 100644 index 0000000..f5a48f8 --- /dev/null +++ b/run-container.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +docker-compose up -d --build + +echo "making sure conteiner properly starts before proceeding... (1 min)" + +sleep 60 + +docker exec -i kapcioszek_strona-mysql_db-1 sh -c 'exec mysql -uroot -e "create database 'strona_praktyka'"' + +docker exec -i kapcioszek_strona-mysql_db-1 sh -c 'exec mysql strona_praktyka < /home/strona_praktyka.sql' + +echo "done! (open localhost:2137/kod in your browser to see the site!)" \ No newline at end of file diff --git a/stop-container.sh b/stop-container.sh new file mode 100644 index 0000000..a986179 --- /dev/null +++ b/stop-container.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker compose down \ No newline at end of file