mirror of
https://github.com/theKapcioszek/kapcioszek_strona.git
synced 2025-04-09 17:14:10 +02:00
fixed sometimes not working menu and also added files for easily running site in docker container
This commit is contained in:
parent
27959f3835
commit
417f299207
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -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
|
27
docker-compose.yml
Normal file
27
docker-compose.yml
Normal file
@ -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
|
@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -40,7 +40,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<a href="<?= $row['link']; ?>">
|
<a href="<?= $row['link']; ?>.php">
|
||||||
<?= $row['name']; ?>
|
<?= $row['name']; ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -85,7 +85,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed " . $link->connect_error);
|
die("Connection failed " . $link->connect_error);
|
||||||
@ -90,7 +90,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed " . $link->connect_error);
|
die("Connection failed " . $link->connect_error);
|
||||||
@ -90,7 +90,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -57,7 +57,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed " . $link->connect_error);
|
die("Connection failed " . $link->connect_error);
|
||||||
@ -90,7 +90,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -40,7 +40,7 @@
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<a href="<?= $row['link']; ?>">
|
<a href="<?= $row['link']; ?>.php">
|
||||||
<?= $row['name']; ?>
|
<?= $row['name']; ?>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
@ -127,7 +127,7 @@
|
|||||||
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
<div><a href="index.php"><b>Kapcioszek</b></a></div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$link = new mysqli("localhost", "root", "");
|
$link = new mysqli("mysql_db", "root", "");
|
||||||
|
|
||||||
if ($link->connect_error) {
|
if ($link->connect_error) {
|
||||||
die("Connection failed: " . $link->connect_error);
|
die("Connection failed: " . $link->connect_error);
|
||||||
|
13
run-container.sh
Normal file
13
run-container.sh
Normal file
@ -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!)"
|
3
stop-container.sh
Normal file
3
stop-container.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker compose down
|
Loading…
x
Reference in New Issue
Block a user