Skip to content
Snippets Groups Projects
Commit 250fb96d authored by Martin Heistermann's avatar Martin Heistermann
Browse files

init

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #9023 passed
.template-docker-windows:
tags:
- cgg
- win22
- shell
variables:
TAG_PREFIX: "windows-"
DOCKERFILE: "Dockerfile"
MSVC_VERSION: "17" # 17: VS 2022
# MSVC_VERSION: "16" # 16: VS 2019
MSVC_CHANNEL: "release"
script:
- $CSUM=$(certutil -Unicode -hashfile ${Env:DOCKERFILE} SHA256)[1]
- $TAG="${Env:CI_REGISTRY_IMAGE}:${Env:TAG_PREFIX}${CSUM}"
- $TAG_LATEST="${Env:CI_REGISTRY_IMAGE}:${Env:TAG_PREFIX}latest"
- echo -n "${Env:CI_JOB_TOKEN}" | docker login -u gitlab-ci-token --password-stdin ${Env:CI_REGISTRY}
- |
docker pull "${TAG}"
if ((-not $?) -or (${Env:CI_PIPELINE_SOURCE} -eq "web") ) {
echo "Building container..."
} else {
echo "Existing container found, tagging as latest..."
docker tag "${TAG}" "${TAG_LATEST}"
docker push "${TAG_LATEST}"
exit 0
}
- docker pull "${TAG_LATEST}"; if (-not $?) { echo "No latest image available." }
- >
docker build
--file ${Env:DOCKERFILE}
--pull
--build-arg MSVC_VERSION="${Env:MSVC_VERSION}"
--build-arg MSVC_CHANNEL="${Env:MSVC_CHANNEL}"
--build-arg VCS_REF="${Env:CI_COMMIT_SHA}"
--build-arg VCS_URL="${Env:CI_PROJECT_URL}"
--memory 4GB
--cache-from "${TAG_LATEST}"
--tag "${TAG}"
.
- echo -n "${Env:CI_JOB_TOKEN}" | docker login -u gitlab-ci-token --password-stdin ${Env:CI_REGISTRY}
- docker push "${TAG}"
- docker tag "${TAG}" "${TAG_LATEST}"
- docker push "${TAG_LATEST}"
after_script:
# Workaround for https://gitlab.com/gitlab-org/gitlab-foss/-/issues/40925
- docker logout ${Env:CI_REGISTRY}
windows-vs2022:
extends: .template-docker-windows
variables:
TAG_PREFIX: "windows-vs2022-"
# MSVC_VERSION: "16" # 16: VS 2019
MSVC_VERSION: "17" # 17: VS 2022
MSVC_CHANNEL: "release"
# TOOLSET: "v142" # 142: VS 2019
# TOOLSET: "v143" # 143: VS 2022
# escape=`
# Let us use PowerShell line continuation.
# https://github.com/thejohnfreeman/rippled-docker/blob/25fb27b8433e405e5235887edf2a63614fcca667/windows/Dockerfile
#FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-1909
#FROM mcr.microsoft.com/windows/servercore:ltsc2022
# Fix the current version (2025-02-11). Feel free to update!
FROM mcr.microsoft.com/windows/servercore:ltsc2022-KB5051979
# Restore the default Windows shell for correct batch processing.
SHELL ["cmd", "/S", "/C"]
# 16: VS 2019
# 17: VS 2022
ARG MSVC_VERSION=17
ARG MSVC_CHANNEL=release
# Download the Visual Studio Build Tools bootstrapper.
ADD https://aka.ms/vs/$MSVC_VERSION/$MSVC_CHANNEL/vs_buildtools.exe C:\Temp\vs_buildtools.exe
# Use the latest release channel.
ADD https://aka.ms/vs/$MSVC_VERSION/$MSVC_CHANNEL/channel C:\Temp\VisualStudio.chman
# For help on command-line syntax:
# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio
# Install MSVC C++ compiler, CMake, and MSBuild.
RUN C:\Temp\vs_buildtools.exe `
--quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--channelUri C:\Temp\VisualStudio.chman `
--installChannelUri C:\Temp\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools;includeRecommended `
--add Microsoft.VisualStudio.Component.VC.CMake.Project `
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset `
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang `
--add Microsoft.Component.MSBuild `
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
#USER ContainerAdministrator
RUN setx /M PATH "C:\Tools\vcpkg;%PATH%"
#USER ContainerUser
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR /app
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
#RUN choco install nuget.commandline
#RUN nuget install clcache -Version 4.1.0 -OutputDirectory c:\tools
RUN choco install -y ccache
RUN choco install -y git.install
ENV CHOCO_CACHE="C:\cache\choco"
ENV CCACHE_DIR "C:\cache\ccache"
RUN choco config set --name=cacheLocation --value="${Env:CHOCO_CACHE}"
ENV VCPKG_ROOT="C:\Tools\vcpkg"
RUN git clone https://github.com/microsoft/vcpkg ${Env:VCPKG_ROOT}
#SHELL ["cmd", "/S", "/C"]
RUN C:\Tools\vcpkg\bootstrap-vcpkg.bat
ARG PLATFORM=x64
# To explicit set VCPKG to only build Release version of the libraries.
# based on https://github.com/PointCloudLibrary/pcl/blob/c1757b554db314699620612ba2e27c0c12141740/.dev/docker/windows/Dockerfile
#COPY $PLATFORM'-windows-rel.cmake' 'c:\vcpkg\triplets\'$PLATFORM'-windows-rel.cmake'
#SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN where vcpkg
RUN vcpkg integrate install
RUN vcpkg install `
eigen3 `
catch2 `
nlohmann-json `
suitesparse-cholmod `
suitesparse-spqr `
pkgconf `
yasm-tool:x86-windows `
--triplet $Env:PLATFORM-windows-release --host-triplet $Env:PLATFORM-windows-release --clean-after-build
#metis
#coin-or-ipopt
#RUN vcpkg install `
# cgal `
# --triplet $Env:PLATFORM-windows-rel --host-triplet $Env:PLATFORM-windows-rel --clean-after-build
# This is for later use in containers, cache does not exist here.
# Therefore, only set this after we're done with vcpkg:
ENV VCPKG_DEFAULT_BINARY_CACHE "C:\cache\vcpkg"
ENTRYPOINT ["C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "-arch=amd64", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
# ENTRYPOINT ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
# ENTRYPOINT ["cmd.exe"]
#ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
ARG VCS_URL
ARG VCS_REF
LABEL org.opencontainers.image.source=${VCS_URL} `
org.opencontainers.image.revision=${VCS_REF}
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_BUILD_TYPE release)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment