File tree Expand file tree Collapse file tree 5 files changed +57
-9
lines changed Expand file tree Collapse file tree 5 files changed +57
-9
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ Language: Cpp
3
3
BasedOnStyle : Google
4
4
ColumnLimit : 80
5
5
IndentWidth : 2
6
- Standard : Cpp11
6
+ Standard : c++17
Original file line number Diff line number Diff line change
1
+ FROM ubuntu:24.04
2
+
3
+ # Define Conan and CMake versions
4
+ ARG CONAN_VERSION=2.6.0
5
+ ARG CMAKE_VERSION=3.30.1
6
+
7
+ # Define User ID and Group ID
8
+ ARG USER_ID=1000
9
+ ARG GROUP_ID=1000
10
+
11
+ WORKDIR /project
12
+
13
+ # Define Labels
14
+ LABEL maintainer="Michele Adduci <adduci@tutanota.com>" \
15
+ description="Docker image for C++ development with Conan and CMake" \
16
+ cmake.version="${CMAKE_VERSION}" \
17
+ conan.version="${CONAN_VERSION}"
18
+
19
+ # Install basic tooling
20
+ RUN apt-get update && \
21
+ apt-get install -y \
22
+ build-essential \
23
+ curl \
24
+ gcc \
25
+ cppcheck \
26
+ clang-format && \
27
+ apt-get clean && \
28
+ rm -rf /var/lib/apt/lists/*
29
+
30
+ # Install Conan and CMake from GitHub Releases
31
+ RUN curl -fsSL https://github.com/conan-io/conan/releases/download/${CONAN_VERSION}/conan-${CONAN_VERSION}-amd64.deb -o /tmp/conan.deb && \
32
+ dpkg -i /tmp/conan.deb && \
33
+ curl -fsSL https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz -o /tmp/cmake.tar.gz && \
34
+ mkdir -p /opt/cmake && \
35
+ tar -xzf /tmp/cmake.tar.gz -C /opt/cmake/ --strip-components=1 && \
36
+ chmod +x /opt/cmake/bin/* && \
37
+ ln -sf /opt/cmake/bin/cmake /usr/bin/cmake && \
38
+ ln -sf /opt/cmake/bin/ctest /usr/bin/ctest && \
39
+ ln -sf /opt/cmake/bin/cpack /usr/bin/cpack && \
40
+ ln -sf /opt/cmake/bin/ccmake /usr/bin/ccmake && \
41
+ rm -rf /tmp/*
42
+
43
+ # Create non-root user to run container with less privileges
44
+ USER ${USER_ID}
45
+
46
+ # Run Conan profile detection as non-root user
47
+ RUN conan profile detect
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ project(moderncpp-project LANGUAGES CXX DESCRIPTION "moderncpp-project is a star
17
17
18
18
# Set Project version (used for library versioning and for CPack)
19
19
set (CMAKE_PROJECT_VERSION_MAJOR 1 )
20
- set (CMAKE_PROJECT_VERSION_MINOR 0 )
21
- set (CMAKE_PROJECT_VERSION_PATCH 0 )
20
+ set (CMAKE_PROJECT_VERSION_MINOR 1 )
21
+ set (CMAKE_PROJECT_VERSION_PATCH 2 )
22
22
set (CMAKE_PROJECT_VERSION ${CMAKE_PROJECT_VERSION_MAJOR} .${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH} )
23
23
24
24
# Set required C++ Standard
Original file line number Diff line number Diff line change 1
1
[requires]
2
- openssl/3.2.1
2
+ openssl/3.2.2
3
3
doctest/2.4.11
4
4
5
5
[generators]
Original file line number Diff line number Diff line change @@ -30,24 +30,25 @@ int32_t hellolib::saySomethingHashed(
30
30
return 1 ;
31
31
}
32
32
33
- EVP_MD_CTX *context = EVP_MD_CTX_new ();
34
- if (context == NULL ) {
33
+ EVP_MD_CTX *context = EVP_MD_CTX_new ();
34
+ if (context == NULL ) {
35
35
std::cerr << " Failed to create context\n " ;
36
36
return 2 ;
37
37
}
38
38
39
- if (1 != EVP_DigestInit_ex (context, EVP_sha256 (), NULL )) {
39
+ if (1 != EVP_DigestInit_ex (context, EVP_sha256 (), NULL )) {
40
40
std::cerr << " Failed to initialize context\n " ;
41
41
return 3 ;
42
42
}
43
43
44
- if (1 != EVP_DigestUpdate (context, (unsigned char *)something.c_str (), something.size ())) {
44
+ if (1 != EVP_DigestUpdate (context, (unsigned char *)something.c_str (),
45
+ something.size ())) {
45
46
std::cerr << " Failed to create hash value\n " ;
46
47
return 4 ;
47
48
}
48
49
49
50
std::array<unsigned char , 32 > buffer{};
50
- if (1 != EVP_DigestFinal_ex (context, buffer.data (), NULL )) {
51
+ if (1 != EVP_DigestFinal_ex (context, buffer.data (), NULL )) {
51
52
std::cerr << " Failed to finalize hash result\n " ;
52
53
return 5 ;
53
54
}
You can’t perform that action at this time.
0 commit comments