diff --git a/.env.example b/.env.example index 55f78229c03af..5b6627f912fad 100644 --- a/.env.example +++ b/.env.example @@ -36,6 +36,9 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug # Whether or not to enable Memcached. LOCAL_PHP_MEMCACHED=false +# Whether or not to enable FTP. +LOCAL_FTP=false + ## # The database software to use. # diff --git a/docker-compose.yml b/docker-compose.yml index 48f3abc607b03..d93085fe174a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -138,6 +138,27 @@ services: php: condition: service_started + ## + # The FTP container. + ## + ftp: + image: 'garethflowers/ftp-server:latest' + + networks: + - wpdevnet + + ports: + - '20-21:20-21/tcp' + - '40000-40009:40000-40009/tcp' + + volumes: + - ./src/:/home/admin/ + + environment: + FTP_USER: admin + FTP_PASS: password + PUBLIC_IP: ${SERVICE_NAME:-ftp} + volumes: # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume. mysql: {} diff --git a/tools/local-env/scripts/start.js b/tools/local-env/scripts/start.js index 0dc8b9570063d..736dc02d2eecc 100644 --- a/tools/local-env/scripts/start.js +++ b/tools/local-env/scripts/start.js @@ -28,9 +28,15 @@ try { } // Start the local-env containers. -const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) - ? 'wordpress-develop memcached' - : 'wordpress-develop'; +let containers = 'wordpress-develop'; + +if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) { + containers += ' memcached'; +} + +if ( process.env.LOCAL_FTP === 'true' ) { + containers += ' ftp'; +} execSync( `docker compose ${composeFiles} up --quiet-pull -d ${containers}`, { stdio: 'inherit' } ); // If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.