Skip to content

Commit

Permalink
Merge pull request #3 from voiceip/docker
Browse files Browse the repository at this point in the history
Docker based build
  • Loading branch information
kingster committed Dec 6, 2019
2 parents 895614d + d1cf22f commit 7352159
Show file tree
Hide file tree
Showing 13 changed files with 233 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,6 @@ GitHubVS.sln.DotSettings
*.ogg

*.dll
lib/datadog-cpp
lib/datadog-cpp

logs/
17 changes: 17 additions & 0 deletions distribution/docker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ignore .git and .cache folders
.git
.cache


# ignore all *.class files in all folders, including build root
**/*.class

bin/

microsip/
Debug/
Release/
*.exe
*.msi

logs/
67 changes: 67 additions & 0 deletions distribution/docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# escape=`

FROM microsoft/dotnet-framework:3.5-windowsservercore-ltsc2016
MAINTAINER Kinshuk B ([email protected])

RUN mkdir C:\BuildTools

# Reset the shell.
SHELL ["cmd", "/S", "/C"]

# Set up environment to collect install errors.
COPY Install.cmd C:\TEMP\
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe

# Download and install Build Tools 14.0
ADD https://download.microsoft.com/download/E/E/D/EEDF18A8-4AED-4CE0-BEBE-70A83094FC5A/BuildTools_Full.exe C:\TEMP\msbuild14.exe
RUN start /wait C:\TEMP\msbuild14.exe /q /full /log C:\TEMP\msbuild14.log

# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman

# Download and install Build Tools for Visual Studio 2017 for native desktop workload.
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--channelUri C:\TEMP\VisualStudio.chman `
--installChannelUri C:\TEMP\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended`
--add Microsoft.Component.MSBuild `
--add Microsoft.VisualStudio.Component.VC.140 `
--add Microsoft.VisualStudio.Component.WinXP `
--installPath C:\BuildTools

# Install Scoop
RUN powershell.exe -ExecutionPolicy RemoteSigned `
iex (new-object net.webclient).downloadstring('https://get.scoop.sh');

# Install Git & other tools
RUN powershell.exe scoop install git wget cmake openssh unzip make

RUN powershell.exe [environment]::setenvironmentvariable('GIT_SSH', (resolve-path (scoop which ssh)), 'USER')

ADD https://dl.bintray.com/boostorg/release/1.68.0/binaries/boost_1_68_0-msvc-14.0-32.exe C:\TEMP\boost_1_68_0-msvc-14.0-32.exe
RUN C:\TEMP\boost_1_68_0-msvc-14.0-32.exe /SILENT

ADD https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe C:\TEMP\wix311.exe
RUN C:\TEMP\Install.cmd C:\TEMP\wix311.exe /install /quiet /norestart

RUN mkdir C:\Code

# fix for paste issue https://github.com/moby/moby/issues/29646#issuecomment-300483809
WORKDIR "Program Files"
RUN rd /S /Q WindowsPowerShell\Modules\PSReadLine

#subst E: C:\Code\tinyphone

WORKDIR C:\BuildTools


ADD VsDevCmdPowerShell.bat C:\BuildTools\
ENTRYPOINT C:\BuildTools\VsDevCmdPowerShell.bat

# Start developer command prompt with any other commands specified.
# ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&

# Default to PowerShell if no other command specified.
# CMD ["powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]
31 changes: 31 additions & 0 deletions distribution/docker/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# escape=`

FROM dotnet3.5-vs17:latest
MAINTAINER Kinshuk B ([email protected])

# Reset the shell.
SHELL ["cmd", "/S", "/C"]

RUN mkdir C:\Build\
WORKDIR C:\Build

# Set up environment to collect install errors.
COPY release.ps1 C:\Build\


# Instal ssh
ADD https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.0.0.0p1-Beta/OpenSSH-Win64.zip OpenSSH-Win64.zip
RUN unzip OpenSSH-Win64.zip
RUN powershell.exe -ExecutionPolicy Bypass -File OpenSSH-Win64\install-sshd.ps1
RUN powershell.exe net start sshd
# RUN powershell.exe Set-Service sshd -StartupType Automatic

ADD https://pastebin.com/raw/W7uZfyBZ C:\Build\fk.patch


EXPOSE 22

ADD VsDevCmdPowerShell.bat C:\Build\
ENTRYPOINT C:\Build\VsDevCmdPowerShell.bat

# CMD ["sshd", "-D"]
17 changes: 17 additions & 0 deletions distribution/docker/Install.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@rem Copyright (C) Microsoft Corporation. All rights reserved.
@rem Licensed under the MIT license. See LICENSE.txt in the project root for license information.

@if not defined _echo echo off
setlocal enabledelayedexpansion

call %*
if "%ERRORLEVEL%"=="3010" (
exit /b 0
) else (
if not "%ERRORLEVEL%"=="0" (
set ERR=%ERRORLEVEL%
call C:\TEMP\collect.exe -zip:C:\vslogs.zip

exit /b !ERR!
)
)
12 changes: 12 additions & 0 deletions distribution/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Build Docker Image

```
docker build -f Dockerfile.base -m 2G -t dotnet3.5-vs17:latest .
docker build -f Dockerfile.build -m 2G -t tinyphone .
```

## Run Docker

```
./release.sh
```
3 changes: 3 additions & 0 deletions distribution/docker/VsDevCmdPowerShell.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
call C:\BuildTools\Common7\Tools\VsDevCmd.bat
powershell.exe -NoLogo -ExecutionPolicy Bypass %*
68 changes: 68 additions & 0 deletions distribution/docker/release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Build Script...
$ErrorActionPreference="Stop"
$BuildMode="Release"


Write-Host 'Building Tinyphone!'

cd C:\Code

git config --global url.https://github.com/.insteadOf git@github.com:
git clone --recurse-submodules -j8 https://github.com/voiceip/tinyphone.git
cd C:\Code\tinyphone\
git checkout docker

git apply C:\Build\fk.patch


cmd /c subst E: C:\Code\tinyphone


cd E:\lib\curl\
.\buildconf.bat
cd E:\lib\curl\winbuild

nmake /f Makefile.vc mode=dll VC=15 DEBUG=no

cd E:\lib\curl\builds
cmd /c MKLINK /D E:\lib\curl\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl E:\lib\curl\builds\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl
ls E:\lib\curl\builds
cmd /c .\libcurl-vc15-x86-release-dll-ipv6-sspi-winssl\bin\curl.exe https://wttr.in/bangalore


#great


#G729
cd E:\lib\bcg729\build\
cmake ..
msbuild /m bcg729.sln /p:Configuration=$BuildMode /p:Platform=Win32


cd E:\lib\cryptopp
msbuild /m cryptlib.vcxproj /p:Configuration=$BuildMode /p:Platform=Win32 /p:PlatformToolset=v140_xp

$wc = New-Object net.webclient; $wc.Downloadfile("https://download.steinberg.net/sdk_downloads/asiosdk_2.3.3_2019-06-14.zip", "E:\lib\portaudio\src\hostapi\asio\asiosdk_2.3.3_2019-06-14.zip")
cd E:\lib\portaudio\src\hostapi\asio
unzip asiosdk_2.3.3_2019-06-14.zip
mv asiosdk_2.3.3_2019-06-14 ASIOSDK
cd E:\lib\portaudio\build\msvc
msbuild /m portaudio.sln /p:Configuration=$BuildMode /p:Platform=Win32

cd E:\lib\pjproject
msbuild /m pjproject-vs14.sln -target:libpjproject:Rebuild /p:Configuration=$BuildMode-Static /p:Platform=Win32

cd E:\lib\statsd-cpp
cmake .
msbuild /m statsd-cpp.vcxproj /p:Configuration=$BuildMode /p:Platform=Win32



#ls E:\lib\curl\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl
cd E:\tinyphone
#msbuild /m tinyphone.sln -target:tinyphone /p:Configuration=$BuildMode /p:Platform=x86
#msbuild /m tinyphone.sln -target:tinyphone:Rebuild /p:Configuration=$BuildMode /p:Platform=x86
msbuild /m tinyphone.sln /p:Configuration=$BuildMode /p:Platform=x86


#git diff --exit-code stampver.inf
10 changes: 10 additions & 0 deletions distribution/docker/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

docker build -m 2G -f Dockerfile.build -t tinyphone .
#docker run -m 2G tinyphone:latest "C:\Build\release.ps1"
cat release.ps1 | docker run -m 2G -i tinyphone

docker cp $(docker ps -a --last 1 -q):"C:\Code\tinyphone\tinyphone-installer\bin\Release\tinyphone_installer.msi" "tinyphone_installer.$(date +%s).msi"

docker rmi $(docker ps -a --last 1 -q)
2 changes: 1 addition & 1 deletion lib/cryptopp
Submodule cryptopp updated 135 files
2 changes: 1 addition & 1 deletion lib/pjproject
Submodule pjproject updated 178 files
2 changes: 1 addition & 1 deletion tinyphone-installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<ComponentGroup Id="ProductSystemComponents" Directory="SystemFolder" >
<Component Id="DLLComponent" Guid="{AE75A17D-3EBF-4B68-AA32-73D18D983315}">
<File Id="libcurl.dll" Name="libcurl.dll" Source="$(var.tinyphone.ProjectDir)\..\lib\curl\builds\libcurl-vc-x86-release-dll-ipv6-sspi-winssl\bin\libcurl.dll" />
<File Id="portaudio_x86.dll" Name="portaudio_x86.dll" Source="$(var.tinyphone.ProjectDir)\..\lib\portaudio\build\msvc\Win32\Release\portaudio_x86.dll" />
<File Id="portaudio_x86.dll" Name="portaudio_x86.dll" Source="$(var.tinyphone.ProjectDir)\..\lib\portaudio\build\msvc\Win32\$(var.tinyphone.Configuration)\portaudio_x86.dll" />

</Component>
</ComponentGroup>
Expand Down
4 changes: 2 additions & 2 deletions tinyphone/stampver.inf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;StampVer information file
FileVersion=32.5.0.6
ProductVersion=32.5.0.6
FileVersion=36.0.0.73
ProductVersion=36.0.0.73
FileFormat=%a.%b.%c
ProductFormat=%a.%b.%c

0 comments on commit 7352159

Please sign in to comment.