Skip to content
Closed
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
9 changes: 8 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
junit_files: ${{ github.workspace }}/*.xml

sprint_2:
if: ${{ false }}
#if: ${{ false }}
runs-on: ubuntu-22.04
container:
image: praktikumcpp/practicum_cpp_backend:latest
Expand All @@ -104,35 +104,42 @@ jobs:
cp -R /home/forconan/.conan /github/home/.conan

- name: run tests sprint2 static_content
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./static_content/run.sh

- name: run tests sprint2 logger
if: ${{ false }}
run: |
./cpp-backend-tests-practicum/scripts/sprint2/logger/run.sh

- name: run tests sprint2 server_logging
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./server_logging/run.sh

- name: run tests sprint2 join_game
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./join_game/run.sh

- name: run tests sprint2 game_state
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./game_state/run.sh

- name: run tests sprint2 move_players
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./move_players/run.sh

- name: run tests sprint2 time_control
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint2
./time_control/run.sh
Expand Down
39 changes: 39 additions & 0 deletions sprint2/problems/command_line/solution/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.11)

project(game_server CXX)
set(CMAKE_CXX_STANDARD 20)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(Threads REQUIRED)

add_definitions(-DBOOST_LOG_STATIC_LINK)

add_executable(game_server
src/main.cpp
src/http_server.cpp
src/http_server.h
src/sdk.h
src/model.h
src/model.cpp
src/tagged.h
src/boost_json.cpp
src/json_loader.h
src/json_loader.cpp
src/json_serializer.h
src/json_serializer.cpp
src/request_handler.cpp
src/request_handler.h
src/ticker.h
src/logger.cpp
src/logger.h
)

target_link_libraries(game_server PRIVATE
${CONAN_LIBS}
Threads::Threads
dl
rt
pthread
)
38 changes: 38 additions & 0 deletions sprint2/problems/command_line/solution/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Не просто создаём образ, но даём stage имя build
FROM gcc:11.3 as build

RUN apt update && \
apt install -y \
python3-pip \
cmake \
&& \
pip3 install conan==1.*

# Сначала зависимости
COPY conanfile.txt /app/
RUN mkdir /app/build && cd /app/build && \
conan install .. --build=missing -s compiler.libcxx=libstdc++11

# Потом исходники
COPY ./src /app/src
COPY CMakeLists.txt /app/

RUN cd /app/build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
cmake --build .

# Второй stage: только запуск
FROM ubuntu:22.04 as run

# Создаём отдельного пользователя
RUN groupadd -r www && useradd -r -g www www

# Копируем собранный бинарник из stage build
COPY --from=build /app/build/bin/game_server /app/
COPY ./data /app/data
COPY ./static /app/static

USER www

# Команда запуска контейнера
ENTRYPOINT ["/app/game_server", "-c", "/app/data/config.json", "-w", "/app/static"]
474 changes: 429 additions & 45 deletions sprint2/problems/command_line/solution/README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions sprint2/problems/command_line/solution/conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[requires]
boost/1.78.0

[generators]
cmake
Loading
Loading