-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_Windows
83 lines (64 loc) · 3.97 KB
/
Dockerfile_Windows
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# escape=`
# Use a specific tagged image. Tags can be changed, though that is unlikely for most images.
# You could also use the immutable tag @sha256:324e9ab7262331ebb16a4100d0fb1cfb804395a766e3bb1806c62989d1fc1326
ARG FROM_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2016
FROM ${FROM_IMAGE}
# Copy our Install script.
COPY Install.cmd C:\TEMP\
# Download collect.exe in case of an install failure.
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe
# Use the latest release channel. For more control, specify the location of an internal layout.
ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman
# Download and install Build Tools excluding workloads and components with known issues.
ADD https://aka.ms/vs/16/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`
--installPath C:\BuildTools
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest 'https://github.com/git-for-windows/git/releases/download/v2.22.0.windows.1/MinGit-2.22.0-64-bit.zip' -OutFile MinGit.zip
RUN Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit; `
$env:PATH = $env:PATH + ';C:\MinGit\cmd\;C:\MinGit\cmd'; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
RUN cd / ;`
git clone git://github.com/SOCI/soci.git
RUN cd / ;`
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest 'https://github.com/Kitware/CMake/releases/download/v3.14.5/cmake-3.14.5-win64-x64.zip' -OutFile cmake.zip;`
Expand-Archive c:\cmake.zip -DestinationPath c:\ ;`
$env:Path += ';c:\cmake-3.14.5-win64-x64\bin'; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
RUN cd c:\ ;`
git clone https://github.com/microsoft/vcpkg ;`
cd vcpkg ;`
.\bootstrap-vcpkg.bat ;`
.\vcpkg.exe integrate install
#RUN cd c:\vcpkg\triplets ;`
# Add-Content x64-windows.cmake 'set(VCPKG_BUILD_TYPE release)'
RUN cd c:\vcpkg ;`
.\vcpkg.exe install http-parser:x64-windows fmt:x64-windows restinio:x64-windows clara:x64-windows cpp-redis:x64-windows json-dto:x64-windows SQLite3:x64-windows boost-lexical-cast:x64-windows boost-math:x64-windows boost-di:x64-windows
RUN cd /soci ;`
mkdir build ;`
cd build ;`
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DWITH_SQLITE3=ON -DWITH_MYSQL=OFF -DSOCI_TESTS=OFF .. ;`
cmake --build . --config Release --target install ;`
$env:Path += ';c:\Program Files (x86)\SOCI\bin\' ; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
RUN cd / ;`
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest 'https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/5.2.4/flyway-commandline-5.2.4-windows-x64.zip' -OutFile flyway.zip;`
Expand-Archive c:\flyway.zip -DestinationPath c:\flyway ;`
$env:Path += ';c:\flyway\flyway-5.2.4\'; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
COPY src C:\src
COPY db C:\db
RUN cd C:\src ;`
mkdir build ;`
cd build ;`
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake .. ;`
cmake --build . --config Release
RUN flyway -locations=filesystem:c:/db/migrations/sql/ -url=jdbc:sqlite:c:/microservice.db -user= -password= migrate
EXPOSE 8088
ENTRYPOINT C:\src\build\Release\micro-service.exe