version: '2' services: db: image: postgres:16 volumes: - './db:/var/lib/postgresql/data' ports: - '5432:5432' environment: POSTGRES_USER: farm POSTGRES_PASSWORD: farm POSTGRES_DB: farm www: depends_on: - db image: farmos/farmos:4.0.0-beta2 user: root entrypoint: /bin/bash command: - -c - | set -ex wait_db_ready() { while { ! exec 3<>/dev/tcp/db/5432; } > /dev/null 2>&1; do sleep 0.1; done } if [ -d /opt/drupal ] && ! [ "$$(ls -A /opt/drupal/)" ]; then echo "farmOS codebase not detected. Copying from pre-built files in the Docker image." cp -rp /var/farmOS/. /opt/drupal mkdir -p /opt/drupal/keys chown -R www-data:www-data /opt/drupal/keys wait_db_ready su www-data -s /bin/bash -c 'drush site-install farm --locale=en --db-url=pgsql://farm:farm@db/farm --site-name=Test0 --account-name=root --account-pass=test' echo " \$$settings['file_private_path'] = '/opt/drupal/web/sites/default/private/files'; " >> /opt/drupal/web/sites/default/settings.php mkdir -p /opt/drupal/web/sites/default/private/files chown -R www-data:www-data /opt/drupal/web/sites/default/private/files fi chown www-data:www-data /opt/drupal wait_db_ready /bin/bash <<'EOF' drush --root=/opt/drupal pm-enable --yes farm_material drush --root=/opt/drupal pm-enable --yes simple_oauth_password_grant drush --root=/opt/drupal pm-enable --yes farm_api_default_consumer composer config repositories.farmos_dev_modules '{"type": "path", "url": "/farmos_dev_modules/farmos_wfs"}' composer require --with-all-dependencies symbioquine/farmos_wfs @dev drush --root=/opt/drupal pm-enable farmos_wfs EOF su www-data -s /bin/bash -c 'echo whoami && id -u && ls -lah /opt && ls -lah /opt/drupal' su www-data -s /bin/bash -c 'exec docker-entrypoint.sh apache2-foreground' volumes: - './www:/opt/drupal' - './php-custom.ini:/usr/local/etc/php/conf.d/php-custom.ini' - '../farmos_wfs:/farmos_dev_modules/farmos_wfs' - '../composer.json:/farmos_dev_modules/farmos_wfs/composer.json' ports: - '80:80' environment: XDEBUG_CONFIG: remote_host=172.22.0.1 FARMOS_FS_READY_SENTINEL_FILENAME: /opt/drupal/www-container-fs-ready