diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bc9fb4b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM php:8-apache + +RUN docker-php-ext-install mysqli + +EXPOSE 80/tcp +EXPOSE 443/tcp diff --git a/README.md b/README.md new file mode 100644 index 0000000..ea56cb0 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# PHP Docker Full Stack + +See https://youtu.be/2Bxh5FNGznQ for a full walk through on spinning up this full-stack Php web app with MySql and phpMySql + +## Requirements: + +* Docker + +## Getting Started + +To run this code, run command: `docker-compose up` from the shell within the directory of this project after cloning it. diff --git a/docker-compose.yml b/docker-compose.yml index 95b4dcf..159cdd2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ version: '3' services: - db: + db: + container_name: mysql image: mysql:latest environment: - MYSQL_DATABASE=php_docker @@ -10,16 +11,20 @@ services: volumes: - "./db:/docker-entrypoint-initdb.d" # this is how we persist a sql db even when container stops www: - image: php:apache + container_name: php + build: + context: . + dockerfile: Dockerfile volumes: - - "./:/var/www/html" # sync the current dir on local machine to the dir of container + - "./src:/var/www/html" # sync the current dir on local machine to the dir of container ports: - 80:80 - 443:443 # for future ssl traffic phpmyadmin: + container_name: phpmyadmin image: phpmyadmin/phpmyadmin ports: - 8001:80 environment: - PMA_HOST=db - - PMA_PORT=3306 \ No newline at end of file + - PMA_PORT=3306 diff --git a/index.php b/src/index.php similarity index 100% rename from index.php rename to src/index.php diff --git a/test.php b/src/test.php similarity index 100% rename from test.php rename to src/test.php