forked from microsoft/FMU-bonsai-connector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-windows_FMU_BASE
85 lines (74 loc) · 3.18 KB
/
Dockerfile-windows_FMU_BASE
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
84
# Use Windows 10 sever
FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS fmu_base
# $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Install Microsoft Visual C++ runtime as described at https://github.com/microsoft/dotnet-framework-docker/issues/15#issuecomment-1068934155
# Some FMU DLLs have dependencies on this runtime
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "vc_redist.x64.exe"; \
Start-Process -filepath C:\vc_redist.x64.exe -ArgumentList "/install", "/passive", "/norestart" -Passthru | Wait-Process; \
Remove-Item -Force vc_redist.x64.exe;
ENV PYTHON_VERSION 3.7.8
ENV PYTHON_RELEASE 3.7.8
RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \
Write-Host ('Downloading {0} ...' -f $url); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \
\
Write-Host 'Installing ...'; \
# https://docs.python.org/3.5/using/windows.html#installing-without-ui
Start-Process python.exe -Wait \
-ArgumentList @( \
'/quiet', \
'InstallAllUsers=1', \
'TargetDir=C:\Python', \
'PrependPath=1', \
'Shortcuts=0', \
'Include_doc=0', \
'Include_pip=0', \
'Include_test=0' \
); \
\
# the installer updated PATH, so we should refresh our local value
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
\
Write-Host 'Verifying install ...'; \
Write-Host ' python --version'; python --version; \
\
Write-Host 'Removing ...'; \
Remove-Item python.exe -Force; \
\
Write-Host 'Complete.'
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 20.2
# https://github.com/pypa/get-pip
ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/cb5b85a8e0c3d13ced611b97816d7490d2f1497e/get-pip.py
ENV PYTHON_GET_PIP_SHA256 a30ff8a3446c592c6d70403a82483716e7b759e8eecba2c8d3f6ecfb34a8d6d7
RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $env:PYTHON_GET_PIP_URL -OutFile 'get-pip.py'; \
Write-Host ('Verifying sha256 ({0}) ...' -f $env:PYTHON_GET_PIP_SHA256); \
if ((Get-FileHash 'get-pip.py' -Algorithm sha256).Hash -ne $env:PYTHON_GET_PIP_SHA256) { \
Write-Host 'FAILED!'; \
exit 1; \
}; \
\
Write-Host ('Installing pip=={0} ...' -f $env:PYTHON_PIP_VERSION); \
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
('pip=={0}' -f $env:PYTHON_PIP_VERSION) \
; \
Remove-Item get-pip.py -Force; \
\
Write-Host 'Verifying pip install ...'; \
pip --version; \
\
Write-Host 'Complete.'
# Setting up main folder
WORKDIR /src
# Transferring folders up
COPY ./FMU_Connector/*.py /src/FMU_Connector/
COPY ./generic /src/generic
# Install requirements
RUN pip3 install -r /src/generic/requirements.txt