-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
83 lines (75 loc) · 1.94 KB
/
docker-compose.yml
File metadata and controls
83 lines (75 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
version: '3.8'
services:
shellock:
hostname: shellock
container_name: shellock
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
volumes:
- .:/var/www/html
environment:
- APP_ENV=dev
- DATABASE_URL=mysql://ssh_user:ssh_password@mariadb:3306/ssh_manager?serverVersion=mariadb-10.11.0
depends_on:
mariadb:
condition: service_healthy
networks:
- ssh-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/login"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
mariadb:
hostname: mariadb
container_name: mariadb
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: ssh_manager
MYSQL_USER: ssh_user
MYSQL_PASSWORD: ssh_password
ports:
- "3306:3306"
volumes:
- mariadb_data:/var/lib/mysql
networks:
- ssh-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "ssh_user", "-pssh_password"]
interval: 10s
timeout: 5s
retries: 5
test-server:
image: debian:12-slim
hostname: test-server
container_name: ssh-test-server
ports:
- "2222:22"
networks:
- ssh-network
command: >
sh -c "
# Install OpenSSH server
apt update &&
apt install -y openssh-server curl sudo jq &&
# Generate host keys
ssh-keygen -A &&
# Configure SSH for testing
sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config &&
sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config &&
sed -i 's/#Port 22/Port 22/' /etc/ssh/sshd_config &&
echo 'Test server ready! SSH available on port 2222' &&
while true; do
sleep 3600;
done
"
volumes:
mariadb_data:
networks:
ssh-network:
driver: bridge