use nanoserver for windows image

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2022-05-11 15:53:32 -06:00
parent 8021570b71
commit f2ca4ed41f
3 changed files with 50 additions and 27 deletions

View File

@ -1,9 +1,9 @@
chart **
dev
examples !/bin
contrib !/csi_proto
node_modules !/csi_proxy_proto
Dockerfile* !/docker
TODO.md !/LICENSE
.git !/package*.json
/ci !/src

View File

@ -129,8 +129,7 @@ jobs:
- self-hosted - self-hosted
- Linux - Linux
- X64 - X64
- csi-sanity-zfs-local - csi-sanity-truenas
#- csi-sanity-truenas-scale
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
@ -163,8 +162,7 @@ jobs:
- self-hosted - self-hosted
- Linux - Linux
- X64 - X64
- csi-sanity-zfs-local - csi-sanity-truenas
#- csi-sanity-truenas-core
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
@ -196,8 +194,7 @@ jobs:
- self-hosted - self-hosted
- Linux - Linux
- X64 - X64
- csi-sanity-zfs-local - csi-sanity-truenas
#- csi-sanity-truenas-core
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
@ -449,10 +446,12 @@ jobs:
os: [windows-2019, windows-2022] os: [windows-2019, windows-2022]
include: include:
- os: windows-2019 - os: windows-2019
base_tag: ltsc2019 core_base_tag: ltsc2019
nano_base_tag: "1809"
file: Dockerfile.Windows file: Dockerfile.Windows
- os: windows-2022 - os: windows-2022
base_tag: ltsc2022 core_base_tag: ltsc2022
nano_base_tag: ltsc2022
file: Dockerfile.Windows file: Dockerfile.Windows
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -460,14 +459,14 @@ jobs:
shell: bash shell: bash
run: | run: |
docker info docker info
docker build --pull -f ${{ matrix.file }} --build-arg BASE_TAG=${{ matrix.base_tag }} -t democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} . docker build --pull -f ${{ matrix.file }} --build-arg NANO_BASE_TAG=${{ matrix.nano_base_tag }} --build-arg CORE_BASE_TAG=${{ matrix.core_base_tag }} -t democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.core_base_tag }} .
docker inspect democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} docker inspect democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.core_base_tag }}
docker save democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} -o democratic-csi-windows-${{ matrix.base_tag }}.tar docker save democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.core_base_tag }} -o democratic-csi-windows-${{ matrix.core_base_tag }}.tar
- name: upload image tar - name: upload image tar
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: democratic-csi-windows-${{ matrix.base_tag }}.tar name: democratic-csi-windows-${{ matrix.core_base_tag }}.tar
path: democratic-csi-windows-${{ matrix.base_tag }}.tar path: democratic-csi-windows-${{ matrix.core_base_tag }}.tar
retention-days: 1 retention-days: 1
push-docker-windows: push-docker-windows:

View File

@ -1,13 +1,34 @@
# docker build --build-arg BASE_TAG=ltsc2019 -t foobar -f Dockerfile.Windows . #
# https://github.com/kubernetes/kubernetes/blob/master/test/images/windows/powershell-helper/Dockerfile_windows
# https://github.com/kubernetes/kubernetes/blob/master/test/images/busybox/Dockerfile_windows
# https://github.com/kubernetes/kubernetes/tree/master/test/images#windows-test-images-considerations
# https://stefanscherer.github.io/find-dependencies-in-windows-containers/
#
# docker build --build-arg NANO_BASE_TAG=1809 --build-arg CORE_BASE_TAG=ltsc2019 -t foobar -f Dockerfile.Windows .
# docker run --rm -ti --entrypoint powershell foobar # docker run --rm -ti --entrypoint powershell foobar
# docker run --rm foobar
# docker save foobar -o foobar.tar
# buildah pull docker-archive:foobar.tar
# mcr.microsoft.com/windows/servercore:ltsc2019 # mcr.microsoft.com/windows/servercore:ltsc2019
# mcr.microsoft.com/windows/nanoserver:1809 # mcr.microsoft.com/windows/nanoserver:1809
ARG BASE_TAG ARG NANO_BASE_TAG
ARG CORE_BASE_TAG
FROM mcr.microsoft.com/windows/servercore:${BASE_TAG} as build FROM mcr.microsoft.com/windows/servercore:${CORE_BASE_TAG} as powershell
# install powershell
ENV PS_VERSION=6.2.7
ADD https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip /PowerShell/powershell.zip
RUN cd C:\PowerShell &\
tar.exe -xf powershell.zip &\
del powershell.zip &\
mklink powershell.exe pwsh.exe
FROM mcr.microsoft.com/windows/servercore:${CORE_BASE_TAG} as build
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
@ -61,10 +82,13 @@ COPY package*.json ./
RUN npm install --only=production; ls / RUN npm install --only=production; ls /
COPY . . COPY . .
FROM mcr.microsoft.com/windows/servercore:${BASE_TAG} FROM mcr.microsoft.com/windows/nanoserver:${NANO_BASE_TAG}
LABEL org.opencontainers.image.source https://github.com/democratic-csi/democratic-csi LABEL org.opencontainers.image.source https://github.com/democratic-csi/democratic-csi
# if additional dlls are required can copy like this
#COPY --from=build /Windows/System32/nltest.exe /Windows/System32/nltest.exe
COPY --from=build /nodejs/node.exe /Windows/system32 COPY --from=build /nodejs/node.exe /Windows/system32
COPY --from=build /app /app COPY --from=build /app /app