-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile.txt
More file actions
58 lines (36 loc) · 993 Bytes
/
dockerfile.txt
File metadata and controls
58 lines (36 loc) · 993 Bytes
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
# Dockerfile to save the server and client scripts
# Giving the user complete access to the scripts in the directory
sudo mkdir -p /root/server
sudo chown -R $USER:$USER /root/server
sudo mkdir -p /root/client
sudo chown -R $USER:$USER /root/client
# Creating files for server and client scripts
sudo touch /root/server/Dockerfile
sudo touch /root/client/Dockerfile
# Run server script
FROM python:latest
ADD /root/server/server.py /chat
WORKDIR /chat
CMD ["python3", "server.py"]
# Run client script
FROM python:latest
ADD /root/client/client.py /chat
WORKDIR /chat
CMD ["python3", "client.py"]
# Docker compose
sudo nano /root/docker-compose.yml
# Writing inside the file
version: "3.8"
services:
server:
build: server/
command: python3 ./server.py
ports:
- "1234:1234"
client:
build: client/
command: python3 ./client.py
network_mode: host
depends_on:
- server
docker-compose up