Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git
.github
.cache
.run
cmake*
build
docker
docs
media
*.md
19 changes: 19 additions & 0 deletions docker/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM build AS build

# Build the client executable
RUN cd build && \
make -j$(nproc) rabbitClientL3cmd

# Runtime stage
FROM ubuntu:latest

# Install necessary packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libboost-all-dev

# Copy the built executable from the build stage
COPY --from=build /usr/src/rabbit/build/rabbitClientL3cmd /usr/local/bin/

# Run the client
CMD ["rabbitClientL3cmd", "-i", "2", "-h", "server", "-p", "3030"]
23 changes: 23 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.8"

services:
server:
build:
context: ..
dockerfile: ./docker/server/Dockerfile
ports:
- "3030:3030"

client:
build:
context: ..
dockerfile: ./docker/client/Dockerfile
depends_on:
- server

worker:
build:
context: ..
dockerfile: ./docker/worker/Dockerfile
depends_on:
- server
53 changes: 53 additions & 0 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM ubuntu:latest AS build

# Install necessary packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
cmake \
python3 \
python3-pip \
python3-venv \
git \
unzip \
tree

# Create and activate a virtual environment
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Upgrade pip and install conan in the virtual environment
RUN pip install --upgrade pip
RUN pip install conan
RUN conan profile detect --force

WORKDIR /usr/src/rabbit

# Download source code
COPY . .

# RUN tree -L 4

# Install dependencies and build the project
RUN conan install . --output-folder=build --build=missing

RUN cd build && cmake ..

RUN cmake -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake" -B build .

# Runtime stage
FROM ubuntu:latest

# Install necessary packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libboost-all-dev

# Copy the built executable from the build stage
COPY --from=build /usr/src/rabbit/build/rabbitServerL3cmd /usr/local/bin/

# Expose the server port
EXPOSE 3030

# Run the server
CMD ["rabbitServerL3cmd", "-p", "3030"]
19 changes: 19 additions & 0 deletions docker/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM build AS build

# Build the worker executable
RUN cd build && \
make -j$(nproc) rabbitWorkerL3cmd

# Runtime stage
FROM ubuntu:latest

# Install necessary packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libboost-all-dev

# Copy the built executable from the build stage
COPY --from=build /usr/src/rabbit/build/rabbitWorkerL3cmd /usr/local/bin/

# Run the worker
CMD ["rabbitWorkerL3cmd", "-i", "123", "-h", "server", "-p", "3030", "-c", "1000"]