Skip to content

Commit 2cb72a8

Browse files
committed
Adding FTP Support
1 parent 7dff371 commit 2cb72a8

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ LOCAL_PHP_XDEBUG_MODE=develop,debug
3636
# Whether or not to enable Memcached.
3737
LOCAL_PHP_MEMCACHED=false
3838

39+
# Whether or not to enable FTP.
40+
LOCAL_FTP=false
41+
3942
##
4043
# The database software to use.
4144
#

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM wordpressdevelop/php:latest
2+
3+
# Install the FTP extension
4+
RUN docker-php-ext-install ftp

docker-compose.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ services:
3232
# The PHP container.
3333
##
3434
php:
35-
image: wordpressdevelop/php:${LOCAL_PHP-latest}
35+
build:
36+
context: .
37+
dockerfile: Dockerfile
3638

3739
networks:
3840
- wpdevnet
@@ -138,6 +140,27 @@ services:
138140
php:
139141
condition: service_started
140142

143+
##
144+
# The FTP container.
145+
##
146+
ftp:
147+
image: 'garethflowers/ftp-server:latest'
148+
149+
networks:
150+
- wpdevnet
151+
152+
ports:
153+
- '20-21:20-21/tcp'
154+
- '40000-40009:40000-40009/tcp'
155+
156+
volumes:
157+
- ./src/:/home/admin/
158+
159+
environment:
160+
FTP_USER: admin
161+
FTP_PASS: password
162+
PUBLIC_IP: ${SERVICE_NAME:-ftp}
163+
141164
volumes:
142165
# So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
143166
mysql: {}

tools/local-env/scripts/start.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ try {
2828
}
2929

3030
// Start the local-env containers.
31-
const containers = ( process.env.LOCAL_PHP_MEMCACHED === 'true' )
32-
? 'wordpress-develop memcached'
33-
: 'wordpress-develop';
31+
let containers = 'wordpress-develop';
32+
33+
if ( process.env.LOCAL_PHP_MEMCACHED === 'true' ) {
34+
containers += ' memcached';
35+
}
36+
37+
if ( process.env.LOCAL_FTP === 'true' ) {
38+
containers += 'ftp';
39+
}
3440
execSync( `docker compose ${composeFiles} up --quiet-pull -d ${containers}`, { stdio: 'inherit' } );
3541

3642
// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.

0 commit comments

Comments
 (0)