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
contrib
node_modules
Dockerfile*
TODO.md
.git
/ci
**
!/bin
!/csi_proto
!/csi_proxy_proto
!/docker
!/LICENSE
!/package*.json
!/src

View File

@ -129,8 +129,7 @@ jobs:
- self-hosted
- Linux
- X64
- csi-sanity-zfs-local
#- csi-sanity-truenas-scale
- csi-sanity-truenas
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
@ -163,8 +162,7 @@ jobs:
- self-hosted
- Linux
- X64
- csi-sanity-zfs-local
#- csi-sanity-truenas-core
- csi-sanity-truenas
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
@ -196,8 +194,7 @@ jobs:
- self-hosted
- Linux
- X64
- csi-sanity-zfs-local
#- csi-sanity-truenas-core
- csi-sanity-truenas
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
@ -449,10 +446,12 @@ jobs:
os: [windows-2019, windows-2022]
include:
- os: windows-2019
base_tag: ltsc2019
core_base_tag: ltsc2019
nano_base_tag: "1809"
file: Dockerfile.Windows
- os: windows-2022
base_tag: ltsc2022
core_base_tag: ltsc2022
nano_base_tag: ltsc2022
file: Dockerfile.Windows
steps:
- uses: actions/checkout@v2
@ -460,14 +459,14 @@ jobs:
shell: bash
run: |
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 inspect democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }}
docker save democratic-csi-windows:${GITHUB_RUN_ID}-${{ matrix.base_tag }} -o democratic-csi-windows-${{ matrix.base_tag }}.tar
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.core_base_tag }}
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
uses: actions/upload-artifact@v2
with:
name: democratic-csi-windows-${{ matrix.base_tag }}.tar
path: democratic-csi-windows-${{ matrix.base_tag }}.tar
name: democratic-csi-windows-${{ matrix.core_base_tag }}.tar
path: democratic-csi-windows-${{ matrix.core_base_tag }}.tar
retention-days: 1
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 foobar
# docker save foobar -o foobar.tar
# buildah pull docker-archive:foobar.tar
# mcr.microsoft.com/windows/servercore:ltsc2019
# 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';"]
@ -61,10 +82,13 @@ COPY package*.json ./
RUN npm install --only=production; ls /
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
# 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 /app /app