Test docker build

This commit is contained in:
2026-05-01 22:02:33 +03:00
parent 10bb22bb01
commit 895ea59d44
3 changed files with 54 additions and 22 deletions
Vendored
+41 -22
View File
@@ -7,32 +7,51 @@ pipeline {
}
stages {
stage('Build Linux') {
stage('Build Docker Image') {
steps {
sh '''
mkdir -p build/linux
g++ main.cpp -o build/linux/test_app
docker build \
-t cpp-mingw-vcpkg:latest \
-f docker/cpp-mingw-vcpkg/Dockerfile .
'''
}
}
stage('Build Windows') {
steps {
sh '''
mkdir -p build/windows
x86_64-w64-mingw32-g++ main.cpp \
-static \
-static-libgcc \
-static-libstdc++ \
-o build/windows/test_app.exe
'''
}
}
stage('Run Linux') {
stage('Build Linux') {
steps {
sh '''
./build/linux/test_app
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
cpp-mingw-vcpkg:latest \
bash -c "
rm -rf build/linux &&
cmake -S . -B build/linux -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake &&
cmake --build build/linux
"
'''
}
}
stage('Build Windows MinGW') {
steps {
sh '''
docker run --rm \
-v "$PWD:/workspace" \
-w /workspace \
cpp-mingw-vcpkg:latest \
bash -c "
rm -rf build/windows &&
cmake -S . -B build/windows -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-mingw-static \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ &&
cmake --build build/windows
"
'''
}
}
@@ -40,16 +59,16 @@ pipeline {
stage('Package') {
steps {
sh '''
cd build
tar -czf linux-build.tar.gz linux
zip -r windows-build.zip windows
mkdir -p artifacts
tar -czf artifacts/linux-build.tar.gz -C build linux
zip -r artifacts/windows-build.zip build/windows
'''
}
}
stage('Archive') {
steps {
archiveArtifacts artifacts: 'build/linux-build.tar.gz, build/windows-build.zip', fingerprint: true
archiveArtifacts artifacts: 'artifacts/*', fingerprint: true
}
}
}