NOTE
This SSH is fine for LOCAL development environments. I strongly advice:
DON'T USE IT IN PRODUCTION!!!
Docker is slow on Mac and Windows when woring with mounted volumes. Most IDE's like Eclipse, PHP-Storm, Webstorm, VSC,... are able to trigger upploads to SSH when files get saved.
There's an SSH Container running which is connected to a volume where your webservers document root is located. On each save action in your IDE an SSH upload will be triggered.
NOTE
This is a one way sync from source to target. The idea behind that is to to use a docker volume for your data (instead o a mounted volume). The volume is used to bypass the docker overlay bottleneck.
- Adjust the ENV Vars (SSH_PASSWORD + SSH_ROOT_PASSWORD) to connect with your passwords via SSH
- Integrate SSH into your project
docker-compose up -d --build --force-recreate --remove-orphans
Exaple docker-compose.yml:
version: '3.2'
services:
#######################################
# Apache
#######################################
web:
image: httpd
ports:
- "8080:80"
volumes:
- target:/usr/local/apache2/htdocs/
#######################################
# Docker SSH Sidecar
#######################################
sshsidecar:
environment:
- SSH_PASSWORD=12345
- SSH_ROOT_PASSWORD=1234567890
image: sebastianzoll/docker-ssh-sidecar:latest
restart: unless-stopped
ports:
- "2222:22"
volumes:
- target:/home/www-data
volumes:
target:
Test your connection first with:
ssh -p 2222 root@localhost
ssh -p 2222 www-data@localhost
To configure PHPStorm, please use this manual.