diff --git a/Dockerfile b/Dockerfile index ec1c2030e13afaa8a37c655290b57fd53b506c10..6a46a0d8bcb62b0b418a2da0fa8eab95fda381c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,6 @@ WORKDIR /var/www/html # Copy the current directory contents into the container at /var/www/html COPY . /var/www/html -# Install mysqli dependency -RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli - # Expose port 80 for the web server EXPOSE 80 diff --git a/docker-compose.yml b/docker-compose.yml index 6f441f25fc68c0c56c75f668986aa78653ec3d6c..a3823ea7679680c20e49a8d717e752c8d3581580 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,27 +2,9 @@ version: '3.3' services: saranghaengbok: build: . - image: tubes-1:latest + container_name: php_app ports: - 8008:80 environment: - DB_HOST: db - db: - image: mysql:latest - ports: - - 6603:3306 - volumes: - - db_data:/var/lib/mysql - environment: - MYSQL_ROOT_PASSWORD: admin - phpmyadmin: - image: phpmyadmin:latest - restart: always - ports: - - 8080:80 - environment: - - PMA_ARBITRARY=1 - - PMA_PORT=3306 - - PMA_HOST=db -volumes: - db_data: + DB_URL: mysql://db/saranghaengbok_php + diff --git a/server/controllers/connect_database.php b/server/controllers/connect_database.php index d4631099b258df113bad1fc9705c81ad0c8bcf83..7a7f49b2ddfff508b3823c52951bcff4f98afb20 100644 --- a/server/controllers/connect_database.php +++ b/server/controllers/connect_database.php @@ -1,7 +1,7 @@ <?php function connect_database(){ // Create a connection - $conn = new mysqli('db', 'saranghaengbok_db_admin', 'BOOMbitchgetouttheway', 'saranghaengbok_db'); + $conn = new mysqli('db-php-app', 'saranghaengbok_db_admin', 'BOOMbitchgetouttheway', 'saranghaengbok_php'); // Check connection if ($conn->connect_error) {