Skip to content

Commit 3097d73

Browse files
authored
Merge pull request #902 from minrk/ssh-windows-base-image
store windows base image in gchr
2 parents 822b723 + 4a782b7 commit 3097d73

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# because it's too unbelievably slow to install ssh server on Windows
2+
name: Build image for Windows SSH CI
3+
4+
on:
5+
workflow_dispatch:
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ipyparallel-windows-ssh
10+
TAG: 3.12-2022
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: windows-2022
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Log in to the Container registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# - name: Extract metadata (tags, labels) for Docker
32+
# id: meta
33+
# uses: docker/metadata-action@v5
34+
# with:
35+
# labels: |
36+
# org.opencontainers.image.title=${{ env.IMAGE_NAME }}
37+
#
38+
# images: ${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
39+
# tags: |
40+
# type=raw,value=${{ env.TAG }}
41+
42+
- name: Build image
43+
# can't use build-push-action on Windows
44+
# https://github.com/docker/build-push-action/issues/18
45+
run: |
46+
docker build -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} -f ci/ssh/win_base_Dockerfile ci/ssh
47+
- name: Push image
48+
run: |
49+
docker push ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}

ci/ssh/win_base_Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# syntax = docker/dockerfile:1.2.1
2+
FROM python:3.12-windowsservercore-ltsc2022
3+
SHELL ["powershell"]
4+
5+
6+
RUN Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'; \
7+
Write-Host 'Install OpenSSH Server...'; \
8+
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0; \
9+
Write-Host 'Initializing OpenSSH Server...'; \
10+
Start-Service sshd; \
11+
Stop-Service sshd
12+
13+
# This is apparently the only way to keep the sshd service running.
14+
# Running sshd in the foreground in the context of a user (as it is done for linux), doesn't work under Windows.
15+
# Even if it is started as admin user, errors occur during logon (lack of some system rights)
16+
CMD powershell -NoExit -Command "Start-Service sshd"

0 commit comments

Comments
 (0)