@@ -13,17 +13,14 @@ FROM microsoft/windowsservercore:ltsc2016
13
13
ENV PYTHONIOENCODING='UTF-8'
14
14
ENV _HOOK_DIR='./pkg/'
15
15
ENV NSIS_LOC='C:/Program Files (x86)/NSIS'
16
+ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
16
17
#Create location for build environment and set as working dir
17
- RUN powershell.exe -Command New-Item c :/temp -ItemType Directory; \
18
+ RUN New-Item C :/temp -ItemType Directory; \
18
19
New-Item C:/data -ItemType Directory;
19
20
WORKDIR C:/temp
20
21
VOLUME C:/data
21
- #############
22
- # Installing Python 3.5.3
23
- #############
24
-
25
- SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
26
22
23
+ #Installing Python 3.5.3
27
24
ENV PYTHON_VERSION 3.5.3
28
25
ENV PYTHON_RELEASE 3.5.3
29
26
@@ -46,7 +43,7 @@ RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env
46
43
'Include_test=0' \
47
44
); \
48
45
\
49
- # the installer updated PATH, so we should refresh our local value
46
+ #the installer updated PATH, so we should refresh our local value
50
47
$env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \
51
48
\
52
49
Write-Host 'Verifying install ...'; \
@@ -84,49 +81,52 @@ RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL);
84
81
pip --version; \
85
82
\
86
83
Write-Host 'Complete.'
87
-
88
84
#############
89
85
90
- ENV CHOCO_URL=https://chocolatey.org/install.ps1
91
86
##install Chocolatey, then git and osquery
92
- RUN powershell.exe -Command Set-ExecutionPolicy Bypass -Scope Process -Force; \
87
+ ENV CHOCO_URL=https://chocolatey.org/install.ps1
88
+ RUN Set-ExecutionPolicy Bypass -Scope Process -Force; \
93
89
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; \
94
90
iex ((New-Object System.Net.WebClient).DownloadString("$env:CHOCO_URL"));
95
- RUN powershell.exe -Command choco install git nssm -y;
96
- RUN powershell.exe -Command choco install osquery --version 3.4.0 -y;
91
+ RUN choco install git nssm -y;
92
+ RUN choco install osquery --version 3.4.0 -y;
97
93
98
94
#RUN powershell.exe $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
99
95
#All the variables used for salt
100
96
ENV SALT_SRC_PATH='C:/temp/salt/'
101
97
ENV SALT_GIT_URL=https://github.com/saltstack/salt
102
98
ENV SALT_CHECKOUT=v2018.11
103
99
#Git clone salt and run packages
104
- RUN powershell.exe -Command git clone "$env:SALT_GIT_URL"; \
100
+ RUN git clone "$env:SALT_GIT_URL"; \
105
101
Push-Location salt/pkg/windows; \
106
102
git checkout "$env:SALT_CHECKOUT"; \
107
103
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; \
108
- C:/temp/salt/pkg/windows /build_env_3.ps1 -Silent;
104
+ . /build_env_3.ps1 -Silent;
109
105
#more salt installs
110
- RUN powershell.exe -Command Push-Location salt; \
111
- test-path C:/temp/salt /setup.py; \
112
- python C:/temp/salt /setup.py --quiet install --force; \
106
+ RUN Push-Location salt; \
107
+ test-path . /setup.py; \
108
+ python . /setup.py --quiet install --force; \
113
109
pop-location;
114
110
#All the variables used for hubble
115
- ARG HUBBLE_CHECKOUT=4.0-pkg-fix
116
- ARG HUBBLE_GIT_URL=https://github.com/jettero /hubble.git
111
+ ARG HUBBLE_CHECKOUT=4.0-win-release
112
+ ARG HUBBLE_GIT_URL=https://github.com/devagupt /hubble.git
117
113
ENV HUBBLE_SRC_PATH='C:/temp/hubble/'
118
114
#Clone Hubble
119
- RUN powershell.exe -Command git clone "$env:HUBBLE_GIT_URL"; \
115
+ RUN git clone "$env:HUBBLE_GIT_URL"; \
120
116
Push-Location hubble; \
121
117
git checkout "$env:HUBBLE_CHECKOUT"; \
122
118
pop-location;
123
119
124
120
#Copy local files to working directory
125
- COPY pyinstaller-requirements.txt c:/temp/
126
121
COPY hubble.conf C:/temp/
127
122
123
+ RUN Push-Location C:/temp/hubble; \
124
+ python setup.py egg_info; \
128
125
#Use pip to install hubble dependencies
129
- RUN powershell.exe -Command pip install -r pyinstaller-requirements.txt;
126
+ pip install -r hubblestack.egg-info/requires.txt \
127
+ -r optional-requirements.txt \
128
+ -r package-requirements.txt; \
129
+ Pop-Location;
130
130
131
131
#Modify gitfs fix for incorrect path variables until fix has been upstreamed
132
132
RUN If (!(Test-Path C:/Python35/Lib/site-packages/salt)) { Copy-Item C:/temp/salt/salt -Destination C:/Python35/Lib/site-packages/ -Recurse -Force}; \
@@ -138,33 +138,5 @@ RUN If (!(Test-Path C:/Python35/Lib/site-packages/salt)) { Copy-Item C:/temp/sal
138
138
RUN $ProgressPreference = 'SilentlyContinue'; \
139
139
Invoke-WebRequest -Uri 'http://repo.saltstack.com/windows/dependencies/64/vcredist_x64_2008_mfc.exe' -OutFile "C:/temp/hubble/pkg/windows/vcredist.exe"
140
140
141
- #Create pyinstaller spec and edit it to work with windows
142
- CMD Push-Location C:/temp/hubble; \
143
- # Copy-Item C:/data/hook-salt.py -Destination C:/temp/hubble/pkg/hook-salt.py; \
144
- # Copy-Item C:/data/salt.grains.core.patch -Destination C:/temp/hubble/pkg/salt.grains.core.patch; \
145
- pyi-makespec --additional-hooks-dir=$env:_HOOK_DIR ./hubble.py; \
146
- $specFile = Get-Content 'C:/temp/hubble/hubble.spec'; \
147
- $specFile = $specFile -replace 'a.binaries','a.binaries + [(''libeay32.dll'', ''C:\Python35\libeay32.dll'', ''BINARY'')]'; \
148
- Set-Content -Path ./hubble.spec -Value $specFile -Force; \
149
- pyinstaller ./hubble.spec; \
150
- Pop-Location; \
151
- #Move the hubble.conf, nssm, and osquery to the correct location
152
- New-Item './hubble/dist/hubble/etc/hubble' -ItemType Directory; \
153
- New-Item './hubble/dist/hubble/osqueryd' -ItemType Directory; \
154
- Move-Item hubble.conf -Destination ./hubble/dist/hubble/etc/hubble/; \
155
- Move-Item 'C:/ProgramData/chocolatey/lib/NSSM/tools/nssm.exe' -Destination './hubble/dist/hubble/' -Force; \
156
- If (Test-Path C:/ProgramData/osquery/osqueryi.exe) {Copy-Item 'C:/ProgramData/osquery/osqueryi.exe' -Destination './hubble/dist/hubble/' -Force} \
157
- Else {Copy-Item 'C:/Program Files/osquery/osqueryi.exe' -Destination './hubble/dist/hubble/' -Force}; \
158
- If (Test-Path C:/ProgramData/osquery/osqueryd/osqueryd.exe) {Copy-Item 'C:/ProgramData/osquery/osqueryd/osqueryd.exe' -Destination './hubble/dist/hubble/osqueryd/' -Force} \
159
- Else {Copy-Item 'C:/Program Files/osquery/osqueryd/osqueryd.exe' -Destination './hubble/dist/hubble/osqueryd/' -Force}; \
160
- If (Test-Path C:/data/hubble.conf) {Copy-Item C:/data/hubble.conf -Destination ./hubble/dist/hubble/etc/hubble/ -Force}; \
161
- If (Test-Path C:/data/opt) {Copy-Item C:/data/opt -Destination './hubble/dist/hubble/' -Recurse -Force}; \
162
- Move-Item 'C:/temp/hubble/pkg/windows/osqueryd_safe_permissions.ps1' -Destination './hubble/dist/hubble/' -Force; \
163
- Move-Item 'C:/temp/hubble/pkg/windows/hubble_config_permissions.ps1' -Destination './hubble/dist/hubble/' -Force; \
164
- Move-Item 'C:/temp/hubble/pkg/windows/prerequisites.ps1' -Destination './hubble/dist/hubble/' -Force; \
165
- #Build the installer
166
- Push-Location 'C:/Program Files (x86)/NSIS'; \
167
- ./makensis.exe /DHubbleVersion="$env:HUBBLE_CHECKOUT" 'C:/temp/hubble/pkg/windows/hubble-Setup.nsi'; \
168
- Get-FileHash -Path C:/temp/hubble/pkg/windows/Hubble*exe -Algorithm SHA256 | Out-File C:/temp/hubble/pkg/windows/hubble_windows.sha256; \
169
- Copy-Item C:/temp/hubble/pkg/windows/Hubble*exe -Destination C:/data/; \
170
- Copy-Item C:/temp/hubble/pkg/windows/hubble_windows.sha256 -Destination C:/data/;
141
+ COPY entrypoint.ps1 C:/temp/
142
+ ENTRYPOINT ["powershell.exe", "C:/temp/entrypoint.ps1"]
0 commit comments