Skip to content

Commit

Permalink
Merge pull request #32 from naviqore/feature/NAV-158-create-docker-st…
Browse files Browse the repository at this point in the history
…ages-build-and-run-ctest

Feature/nav 158 create docker stages build and run ctest
  • Loading branch information
Brunner246 authored Aug 26, 2024
2 parents 663ca9d + 1c32689 commit 4264bbc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@
/vcpkg_installed
/build
/Folder.DotSettings.user
/packages/*
/vcpkg_installed/*
20 changes: 1 addition & 19 deletions src/CMakePresets.json → CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"toolchainFile": "C:/Users/MichaelBrunner/.vcpkg-clion/vcpkg-raptorxx/scripts/buildsystems/vcpkg.cmake"
"toolchainFile": "${sourceDir}/packages/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "x64-debug",
Expand All @@ -36,24 +36,6 @@
"description": "Target Windows (64-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"inherits": "x64-debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
},
{
"name": "x86-debug",
"displayName": "x86 Debug",
"description": "Target Windows (32-bit) with the Visual Studio development environment. (Debug)",
"inherits": "windows-base",
"architecture": {
"value": "x86",
"strategy": "external"
},
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "x86-release",
"displayName": "x86 Release",
"description": "Target Windows (32-bit) with the Visual Studio development environment. (RelWithDebInfo)",
"inherits": "x86-debug",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
}
]
}
4 changes: 2 additions & 2 deletions src/CMakeSettings.json → CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"cmakeToolchain": "C:/Users/MichaelBrunner/.vcpkg-clion/vcpkg-raptorxx/scripts/buildsystems/vcpkg.cmake"
"cmakeToolchain": "${projectDir}/packages/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "x64-Release",
Expand All @@ -22,7 +22,7 @@
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"cmakeToolchain": "C:/Users/MichaelBrunner/.vcpkg-clion/vcpkg-raptorxx/scripts/buildsystems/vcpkg.cmake"
"cmakeToolchain": "${projectDir}/packages/scripts/buildsystems/vcpkg.cmake"
}
]
}
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
FROM gcc:latest
# Stage 1: Build environment
FROM gcc:latest AS build

RUN apt-get update && apt-get install -y cmake git curl zip unzip tar

# vcpkg to install dependencies
RUN git clone https://github.com/microsoft/vcpkg.git /usr/src/vcpkg
WORKDIR /usr/src/vcpkg
RUN ./bootstrap-vcpkg.sh

COPY . /usr/src/myapp/
COPY vcpkg.json /usr/src/myapp
WORKDIR /usr/src/myapp
COPY . /usr/src/raptorxx/
COPY vcpkg.json /usr/src/raptorxx

WORKDIR /usr/src/raptorxx
RUN /usr/src/vcpkg/vcpkg install --triplet x64-linux

# Configure and build the project
RUN cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/usr/src/vcpkg/scripts/buildsystems/vcpkg.cmake
RUN cmake --build build

RUN echo "RUNNING TESTS"
# CMD ["/bin/bash"]

RUN ctest --test-dir build --output-on-failure
# Stage 2: Test execution environment
FROM build AS runtime

WORKDIR /usr/src/raptorxx

COPY --from=build /usr/src/raptorxx/output/bin/release /usr/src/raptorxx/build
CMD for test_exe in /usr/src/raptorxx/build/*_tests; do echo "Running $test_exe"; "$test_exe"; done

# $ docker build -t my-gcc-linux-app .
# $ docker run -it --rm --name my-running-app my-gcc-linux-app

0 comments on commit 4264bbc

Please sign in to comment.