diff --git a/.gitignore b/.gitignore index c7f7bd3..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +0,0 @@ - -dbConnect.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f95b823 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM php:7.0-apache + +RUN apt-get update +RUN docker-php-ext-install pdo pdo_mysql mysqli +RUN a2enmod rewrite diff --git a/~dbConnect.php b/dbConnect.php similarity index 77% rename from ~dbConnect.php rename to dbConnect.php index 888225d..be2e0a1 100644 --- a/~dbConnect.php +++ b/dbConnect.php @@ -1,12 +1,12 @@ -connect_error) { die('Connect Error (' . $database->connect_errno . ') ' . $database->connect_error); } -?> \ No newline at end of file +?> diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8222ba9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3' + +services: + db: + build: + context: ./sql + ports: + - "5455:3306" + volumes: + - "db-data:/var/lib/mysql" + environment: + MYSQL_ROOT_PASSWORD: "Test" + + webserver: + build: + context: . + ports: + - "80:80" + volumes: + - "./:/var/www/html" + depends_on: + - db + +volumes: + db-data: + + +# docker run -d -p 5455:3306 -v `pwd`/setup:/docker-entrypoint-initdb.d/ -v `pwd`/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Test mariadb +# docker run -d -p 80:80 --name my-apache-php-app -v `pwd`:/var/www/html php:7.0-apache diff --git a/sql/Dockerfile b/sql/Dockerfile index a6f0619..4602ce3 100644 --- a/sql/Dockerfile +++ b/sql/Dockerfile @@ -1,2 +1,2 @@ FROM mariadb -COPY ./sql-dump.sql /docker-entrypoint-initdb.d/ +COPY ./sample-db.sql /docker-entrypoint-initdb.d/ diff --git a/sql/run-container.sh b/sql/run-container.sh deleted file mode 100644 index d61be82..0000000 --- a/sql/run-container.sh +++ /dev/null @@ -1 +0,0 @@ -docker run -d -p 5455:3306 -v `pwd`/setup:/docker-entrypoint-initdb.d/ -v `pwd`/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Test mariadb