Skip to content

Commit

Permalink
ci: Build a windows docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitjano committed Apr 26, 2024
1 parent 765bb65 commit 68aba6e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include:
- local: /.gitlab/pipeline/sonar.yml
- local: /.gitlab/pipeline/lint-code.yml
- local: /.gitlab/pipeline/test-code.yml
- local: ./gitlab/pipeline/build-windows.yml

sast:
stage: test
10 changes: 10 additions & 0 deletions .gitlab/dockerfiles/Dockerfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM mcr.microsoft.com/windows/servercore:ltsc2022

SHELL ["powershell", "-Command"]

# download and install vs build tools needed by vcpkg
RUN Invoke-WebRequest "https://aka.ms/vs/17/release/vs_buildtools.exe" \
-OutFile "%TEMP%\vs_buildtools.exe" -UseBasicParsing
RUN "%TEMP%\vs_buildtools.exe" --quiet --wait --norestart --noUpdateInstaller \
--add Microsoft.VisualStudio.Workload.VCTools \
--includeRecommended
27 changes: 27 additions & 0 deletions .gitlab/pipeline/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
build:windows:
stage: 📦 build
tags:
- windows
rules:
# on default branch
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
when: always
# on a tag
- if: $CI_COMMIT_TAG
# on a MR if previous jobs are successful
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: manual
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build
--pull
--cache-from $CI_REGISTRY_IMAGE:latest
--tag $CI_REGISTRY_IMAGE:windows_$CI_COMMIT_SHA
-f .gitlab/dockerfiles/Dockerfile.windows
.
- docker push $CI_REGISTRY_IMAGE:windows_$CI_COMMIT_SHA
after_script:
- docker logout $CI_REGISTRY


0 comments on commit 68aba6e

Please sign in to comment.