I’m trying to build an app that uses a tcp socket client-server communication. As such I’ve got 3 dockers - 1st for the server, 2nd for the client and 3rd for the tests(which work btw). Besides the client(that uses python), everything is coded on C++.
The code goes as follows:
Yaml code:
version: "3.9"
services:
server:
build:
context: .
dockerfile: src/server_folder/Dockerfile
container_name: cpp_server
volumes:
- ./data:/app/data
networks:
- server_client_network
ports:
- "12345:12345"
restart: unless-stopped
stdin_open: true
tty: true
tests:
build:
context: .
dockerfile: src/tests/Dockerfile
container_name: cpp_tests
volumes:
- ./data:/app/data
networks:
- server_client_network
ports:
- "5555:5555"
- "5556:5556"
command: ./build/Run_TDD
stdin_open: true
tty: true
client:
build:
context: .
dockerfile: src/client_folder/Dockerfile
container_name: python_client
networks:
- server_client_network
restart: "no"
stdin_open: true
tty: true
networks:
server_client_network:
driver: bridge
volumes:
data:
server docker code:
FROM gcc:latest
RUN apt-get update && apt-get install -y cmake
COPY src/server_folder /app/src/server_folder
COPY src/tests /app/src/tests
COPY data /app/data
COPY CMakeLists.txt /app
WORKDIR /app
RUN mkdir build
WORKDIR /app/build
RUN cmake .. && make
ENTRYPOINT ["./app"]
client docker:
FROM python:3.10-slim
WORKDIR /client
COPY src/client_folder/Client.py .
ENTRYPOINT ["python3", "Client.py"]