Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM wordpressdevelop/php:latest

# Install the FTP extension
RUN docker-php-ext-install ftp
25 changes: 24 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ services:
# The PHP container.
##
php:
image: wordpressdevelop/php:${LOCAL_PHP-latest}
build:
context: .
dockerfile: Dockerfile

networks:
- wpdevnet
Expand Down Expand Up @@ -138,6 +140,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: {}
Expand Down
12 changes: 9 additions & 3 deletions tools/local-env/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading