Docker Community Forums

Share and learn in the Docker community.

Dockerize the gitlab project (.exe application)


(User1989) #1

Hi,

I have tool (.exe) which runs on windows machine. The tool is build in gitlab CI/CD. Now, I want to dockerize the build. The yaml file is as shown below. To build, I need basically two things:

• The Visual Studio C++ compiler https://visualstudio.microsoft.com/
• The open source version of the Qt library from https://www.qt.io/download
The output of the build is compressed to zip format and uploaded to artifactory server. The tool is delivered over artifactory server isn ZIP format. How can I use or create docker image for build tools.

variables:
  PROJECT_NAME: "Demo Project"
  GIT_SSL_NO_VERIFY: "true"
  REPOSITORY_NAME: "test" 
  ARTIFACTORY_ROOT_PATH: ""
  ARTIFACTORY_WEBSITE: ""
  ARTIFACTORY_USER: ""
  CURL: "C:\\build-tools\\curl\\bin\\curl.exe"
  JQ: "C:\\build-tools\\jq\\jq-win64.exe"
  TEMPFILE: "C:\\build-tools\\jq\\temp.txt" 
  REPLACE_VERSION_RELEASE_DATE: "C:\\build-tools\\ReplaceVersionReleasedate\\ReplaceVersionReleasedate.exe"
  ZIP: "C:\\Program Files\\7-Zip\\7z.exe"
  QTIFW_REPOGEN: "c:\\QT\\QtIFW-3.0.4\\bin\\repogen"
  JFROG_CLI: "C:\\build-tools\\JFROG-CLI\\jfrog"
  JOM: "C:\\Qt\\Tools\\QtCreator\\bin\\jom.exe"
before_script:
  - echo "starting build for %PROJECT_NAME%"
  - SET BUILDVER=%CI_COMMIT_TAG:~3%
  - set PATH=C:\Qt\5.10.1\msvc2015_64\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC;%PATH%
  - call vcvarsall.bat x86_amd64
stages:
  - build
  - deploy_rv
build:
  stage: build
  script:
  - echo "Building (Release)..."
  - 'RMDIR /S /Q dist'
  - 'qmake test.pro -spec win32-msvc "CONFIG+=release" "CONFIG+=qml_release"'
  - '%JOM% qmake_all'
  - '%JOM%'
  - '%JOM% install'
  - 'qmake test.pro -spec win32-msvc "CONFIG+=release" "CONFIG+=qml_release"'
  - '%JOM% qmake_all'<
  - '%JOM%'
  - '%JOM% install'
  - 'MD dist\release_build\test_app'
  - echo "Copying files into build folder ..."
  - 'xcopy test_app\mlapp_redist\*.* dist\release_build\test_app /E /Y >NUL'
 
  artifacts:
    paths:
    - dist/

deploy_rv:
  stage: deploy_rv
  script:
  - echo "Deploy Artifact..."
  # Compress Artifact
  - '"%ZIP%" a test.rv.zip dist/'
  - '"%ZIP%" a test.rv-%BUILDVER%.zip dist/'
  
  # Configure JFrog CLI with parameters of your Artifactory instance
  - '%JFROG_CLI% rt config --url  %ARTIFACTORY_WEBSITE% --user %ARTIFACTORY_USER% --apikey %API_KEY%'
  
  - 'set mydate=%DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%'
    
  - '%JFROG_CLI% rt u "test.rv.zip" %ARTIFACTORY_ROOT_PATH%/tools/test/test.rv.zip --build-name=test.rv --build-number=%BUILDVER%  --props releasenote=%releasenote%;releaseversion=%BUILDVER%;releasedate=%mydate% --flat=false'
  - '%JFROG_CLI% rt u "test.rv-%BUILDVER%.zip" %ARTIFACTORY_ROOT_PATH%/tools/test/test.rv-%BUILDVER%.zip --build-name=test.rv-%BUILDVER% --build-number=%BUILDVER%  --props releasenote=%releasenote%;releaseversion=%BUILDVER%;releasedate=%mydate% --flat=false'

  #  Publish build info to Artifactory.
  - '%JFROG_CLI% rt bp test.rv %BUILDVER%'
  - '%JFROG_CLI% rt bp test.rv-%BUILDVER% %BUILDVER%'
  
  # Trigger to update other Repository
  - '%CURL% -X POST -F token=%My_TOKEN% -F ref=master -F "variables[RELEASE]=true" -F "variables[PROGRAM]=test" --insecure https://gitlab/project/trigger/pipeline'
  only:
  - /^(rv-)(\d+\.)(\d+\.)(\d+)$/