Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Last active February 24, 2025 23:46
Show Gist options
  • Save ainsofs/92695829be9ad4f4a46d4ac84db5c7a5 to your computer and use it in GitHub Desktop.
Save ainsofs/92695829be9ad4f4a46d4ac84db5c7a5 to your computer and use it in GitHub Desktop.
docker4drupal gitpod setup
# Ignore gitpod files
.env.gitpod
tasks:
- init: |
# fix permissions
sudo chown -R gitpod:gitpod .
# set aliases
source .bash_aliases
cp .env .env.gitpod
# IMPORTANT: Update the CHANGE_ME text
sed -i "s|PROJECT_BASE_URL=[CHANGE_ME].docker.localhost|PROJECT_BASE_URL=${GITPOD_WORKSPACE_URL}|g" .env.gitpod
sed -i "s|PROJECT_BASE_URL=https://|PROJECT_BASE_URL=8000-|g" .env.gitpod
make gitpod
make composer install
echo "Loading..."
make composer build
command: |
# Add more startup tasks
make gitpod
echo "Ready!"
echo "Your site URL: $(gp url 8000)"
make drush 'uli --uri=$(gp url 8000)'
# VScode xdebug extension
vscode:
extensions:
# PHP & Drupal Development
- felixfbecker.php-debug
- wongjn.php-sniffer
- neilbrayfield.php-docblocker
- bmewburn.vscode-intelephense-client
- devsense.composer-php-vscode
- mblode.twig-language-2
- valeryanm.vscode-phpsab
- xdebug.php-debug
- devsense.phptools-vscode
# Git & Collaboration
- eamodio.gitlens
- mhutchie.git-graph
# Editor Enhancement
- esbenp.prettier-vscode
- editorconfig.editorconfig
- streetsidesoftware.code-spell-checker
# Database
- cweijan.vscode-mysql-client2
# YAML & Configuration
- redhat.vscode-yaml
# AI extensions.
# - codeium.codeium
ports:
- port: 8000 # if using port 8000
onOpen: open-browser
services:
php:
user: root
command: "php-fpm -R"
environment:
PHP_FPM_USER: root
PHP_FPM_GROUP: root
## gitpod : Start up gitpod containers.
.PHONY: gitpod
gitpod:
@echo "Starting up gitpod containers for $(PROJECT_NAME)..."
docker compose -f compose.yml -f compose.override-sample.yml -f compose.gitpod.yml --env-file=.env.gitpod up -d --remove-orphans
## gitpod_fix : Fix gitpod permissions.
.PHONY: gitpod_fix
gitpod_fix:
@echo "Fixing gitpod containers for $(PROJECT_NAME)..."
sudo chown -R gitpod:gitpod .
<?php
$settings['trusted_host_patterns'] = array(
'\.localhost$', '\.local$', '\.loc$', 'localhost', 'nginx', '\.gitpod.io$',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment