diff --git a/.gitignore b/.gitignore index a32768a9..888b2264 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,16 @@ -# ignore everything in the root except the "wp-content" directory. -!wp-content/ -# ignore everything in the "wp-content" directory, except: -# "mu-plugins", "plugins", "themes" directory -wp-content/* -!wp-content/mu-plugins/ -!wp-content/plugins/ -!wp-content/themes/ +# ignore main wordpress files +wp-root/* +!wp-root/wp-content/ -# ignore these plugins -wp-content/plugins/hello.php +# ignore the default plugins +wp-root/wp-content/plugins/hello.php +wp-root/wp-content/plugins/index.php +wp-root/wp-content/plugins/akismet/* -# ignore specific themes -wp-content/themes/twenty*/ +# ignore the default themes +wp-root/wp-content/themes/twenty*/ +wp-root/wp-content/themes/index.php # ignore node dependency directories node_modules/ @@ -20,4 +18,4 @@ node_modules/ # ignore log files and databases *.log *.sql -*.sqlite +*.sqlite \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 90ef31fa..7022b442 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,8 +1,27 @@ tasks: - - init: | + - name: Install + # The built step is helpful because we modify the wordpress docker image to include wp-CLI + init: | docker-compose pull - - command: | + docker-compose build + echo "Docker images built. Starting Docker..." + command: | + gp sync-done docker docker-compose up + + - name: Set permission + # Waits a little and then configures Wordpress + # Last line opens Website in new browser window + # Set permission that "gitpod" user can access folders created inside docker container. Couldn't find a better way. + init: | + gp sync-await docker + echo "Waiting 10s for DB to get ready..." + sleep 10 + sudo chmod -R 755 ./wp-root + sudo chown -R gitpod:gitpod ./wp-root + # Then open Wordpress in Browser and tail logs + command: | + gp preview $(gp url 8000) --external vscode: extensions: diff --git a/docker-compose.yml b/docker-compose.yml index 8074184e..20915cb8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,7 @@ -version: "3.9" - + services: db: - image: mysql:5.7 + image: mysql:latest volumes: - database:/var/lib/mysql restart: always @@ -16,8 +15,6 @@ services: depends_on: - db image: wordpress:latest - volumes: - - src:/var/www/html ports: - "8000:80" restart: always @@ -25,8 +22,10 @@ services: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress - WORDPRESS_DB_NAME: wordpress + volumes: + - ./wp-root:/var/www/html + - ./apache-logs/:/var/log/apache2 volumes: database: - src: + apache-logs: