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
16 changes: 10 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ jobs:
./command_line/run.sh

sprint_3:
#if: ${{ false }}
if: github.repository_owner != 'cpppracticum'
if: ${{ false }}
#if: github.repository_owner != 'cpppracticum'
runs-on: ubuntu-22.04
steps:
- name: Checkout code & tests
Expand Down Expand Up @@ -274,6 +274,7 @@ jobs:

sprint_4:
if: ${{ false }}
#if: github.repository_owner != 'cpppracticum'
runs-on: ubuntu-22.04
steps:
- name: Checkout code & tests
Expand All @@ -300,8 +301,8 @@ jobs:
junit_files: ${{ github.workspace }}/*.xml

sprint_3_with_server:
#if: ${{ false }}
if: github.repository_owner != 'cpppracticum'
if: ${{ false }}
#if: github.repository_owner != 'cpppracticum'
runs-on: ubuntu-22.04
container:
image: praktikumcpp/practicum_cpp_backend_server:latest
Expand Down Expand Up @@ -336,8 +337,8 @@ jobs:
junit_files: ${{ github.workspace }}/*.xml

sprint_4_with_postgress:
if: ${{ false }}
#if: github.repository_owner != 'cpppracticum'
#if: ${{ false }}
if: github.repository_owner != 'cpppracticum'
runs-on: ubuntu-22.04
container:
image: praktikumcpp/practicum_cpp_backend:latest
Expand Down Expand Up @@ -369,16 +370,19 @@ jobs:
cp -R /home/forconan/.conan /github/home/.conan

- name: run tests sprint4 db_of_books
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint4
./db_of_books/run_postgresless.sh

- name: run tests sprint4 bookypedia-1
if: ${{ false }}
run: |
cd cpp-backend-tests-practicum/scripts/sprint4
./bookypedia-1/run_postgresless.sh

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

project(game_server CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

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
src/players.h
src/player_tokens.h
src/use_cases.h
src/loot_generator.h
src/loot_generator.cpp
src/extra_data.h
src/extra_data.cpp
src/collision_detector.h
src/collision_detector.cpp
src/geom.h
src/model_serialization.h
src/state_serialization.h
src/db.h
)

target_link_libraries(game_server PRIVATE
${CONAN_LIBS}
Threads::Threads
)
38 changes: 38 additions & 0 deletions sprint4/problems/leave_game/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"]
Loading
Loading