added db and phpmyadmin on docker compose
This commit is contained in:
@@ -10,17 +10,15 @@
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
2. Build and run the Docker container:
|
||||
2. Start and run the Docker container:
|
||||
```bash
|
||||
# Build the Docker image
|
||||
docker build -t wordpress-assessment .
|
||||
# Start the container
|
||||
docker-compose up -d
|
||||
|
||||
# Run the container
|
||||
docker run -d -p 8882:8882 wordpress-assessment
|
||||
# Stop the container
|
||||
docker-compose down
|
||||
```
|
||||
|
||||
The WordPress site will be available at http://localhost:8882
|
||||
|
||||
|
||||
3. Access WordPress Admin:
|
||||
- URL: http://localhost:8882/wp-admin
|
||||
@@ -37,6 +35,11 @@
|
||||
- Login to wp-admin to verify admin access
|
||||
- Check that PHP and MySQL are working correctly
|
||||
|
||||
6. Access phpmyadmin Admin:
|
||||
- URL: http://localhost:8888
|
||||
|
||||
7. Mysql server would be running on port 3306
|
||||
|
||||
## Project Structure
|
||||
|
||||
### Core Files
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
wordpress:
|
||||
build: .
|
||||
ports:
|
||||
- "8882:8882"
|
||||
volumes:
|
||||
- ./:/var/www/html
|
||||
environment:
|
||||
- WORDPRESS_DB_HOST=db
|
||||
- WORDPRESS_DB_USER=wordpress
|
||||
- WORDPRESS_DB_PASSWORD=wordpress_password
|
||||
- WORDPRESS_DB_NAME=wordpress
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_DATABASE=wordpress
|
||||
- MYSQL_USER=wordpress
|
||||
- MYSQL_PASSWORD=wordpress_password
|
||||
command: '--default-authentication-plugin=mysql_native_password'
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin
|
||||
ports:
|
||||
- "8888:80"
|
||||
environment:
|
||||
- PMA_HOST=db
|
||||
- PMA_USER=wordpress
|
||||
- PMA_PASSWORD=wordpress_password
|
||||
- MYSQL_ROOT_PASSWORD=somewordpress
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
||||
+4
-4
@@ -20,16 +20,16 @@
|
||||
|
||||
// ** Database settings - You can get this info from your web host ** //
|
||||
/** The name of the database for WordPress */
|
||||
define( 'DB_NAME', 'database_name_here' );
|
||||
define( 'DB_NAME', getenv('WORDPRESS_DB_NAME') ?: 'wordpress' );
|
||||
|
||||
/** Database username */
|
||||
define( 'DB_USER', 'username_here' );
|
||||
define( 'DB_USER', getenv('WORDPRESS_DB_USER') ?: 'wordpress' );
|
||||
|
||||
/** Database password */
|
||||
define( 'DB_PASSWORD', 'password_here' );
|
||||
define( 'DB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD') ?: 'wordpress_password' );
|
||||
|
||||
/** Database hostname */
|
||||
define( 'DB_HOST', 'localhost' );
|
||||
define( 'DB_HOST', getenv('WORDPRESS_DB_HOST') ?: 'db' );
|
||||
|
||||
/** Database charset to use in creating database tables. */
|
||||
define( 'DB_CHARSET', 'utf8' );
|
||||
|
||||
Reference in New Issue
Block a user