Skip to content

Commit 2013cfb

Browse files
committed
Revert "fix: remove the scripts and Dockerfile for windows os which are unused and confusing"
This reverts commit 325495a.
1 parent 5b6a397 commit 2013cfb

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

Dockerfile.windows

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
ARG OS_RELEASE
2+
3+
FROM mcr.microsoft.com/windows/servercore:${OS_RELEASE} as download
4+
5+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
6+
7+
ENV GIT_VERSION 2.39.0
8+
ENV NODE_VERSION 16.20.0
9+
ENV YARN_VERSION 1.22.19
10+
11+
# Download and install git
12+
RUN Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.1/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION) -OutFile 'MinGit.zip' -UseBasicParsing ; \
13+
Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit; \
14+
$env:PATH = $env:PATH + ';C:\MinGit\cmd\;C:\MinGit\cmd'; \
15+
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH
16+
17+
# Download and install node.js
18+
RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \
19+
# $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \
20+
# if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \
21+
Expand-Archive node.zip -DestinationPath C:\ ; \
22+
Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs'
23+
24+
# Download and install yarn
25+
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
26+
Invoke-WebRequest $('https://github.com/yarnpkg/yarn/releases/download/v{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \
27+
Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait
28+
29+
FROM download as install
30+
31+
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
32+
33+
ENV NPM_CONFIG_LOGLEVEL info
34+
35+
COPY --from=download /nodejs /nodejs
36+
COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ]
37+
38+
RUN $env:PATH = 'C:\nodejs;C:\yarn\bin;{0}' -f $env:PATH ; \
39+
[Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine)
40+
41+
FROM install
42+
43+
WORKDIR C:/cf-container-logger
44+
45+
COPY package.json ./
46+
47+
COPY yarn.lock ./
48+
49+
RUN yarn install --frozen-lockfile --production
50+
51+
COPY . ./
52+
53+
LABEL owner="codefresh.io"
54+
55+
CMD ["powershell", "./lib/forever.ps1"]

lib/forever.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
while ($true) {
2+
Start-Sleep -s 1
3+
& node dist/index.js
4+
}

lib/isReady.ps1

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# DEPRECATED:
2+
# This script is no longer maintained, you should use the ./isReady.js script
3+
# Leaving this script for backwards compatibility (so this container logger can work with older engines)
4+
5+
$CONTAINER_ID=$args[0]
6+
7+
if ( $CONTAINER_ID ) {
8+
echo "checking if container:$CONTAINER_ID exists"
9+
if (select-string -Pattern $CONTAINER_ID -Path ./dist/state.json) {
10+
echo "container $CONTAINER_ID is ready"
11+
Exit 0
12+
} else {
13+
echo "container $CONTAINER_ID is not ready"
14+
Exit 1
15+
}
16+
} else {
17+
echo "checking if container logger is ready"
18+
if (select-string -Pattern "ready" -Path ./dist/state.json) {
19+
echo "ready"
20+
Exit 0
21+
} else {
22+
echo "not ready"
23+
Exit 1
24+
}
25+
}

0 commit comments

Comments
 (0)