Skip to content

Commit 3ce5d83

Browse files
authored
Merge pull request #41 from thespad/3.21
Rebase to 3.21
2 parents c1107ca + d66d771 commit 3ce5d83

7 files changed

+120
-10
lines changed

.github/workflows/call-baseimage-update.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77

88
jobs:
99
call-workflow:
10-
uses: thespad/actions/.github/workflows/check-baseimage-update.yml@v8
10+
uses: thespad/actions/.github/workflows/check-baseimage-update.yml@v8.0.5
1111
with:
1212
repo_owner: "thespad"
1313
baseimage: "alpine"
14-
basebranch: "3.20"
14+
basebranch: "3.21"
1515
app_name: "py-kms"
1616
secrets:
1717
repo_scoped_token: ${{ secrets.repo_scoped_token }}

.github/workflows/call-build-image.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
call-workflow:
11-
uses: thespad/actions/.github/workflows/build-image.yml@v8
11+
uses: thespad/actions/.github/workflows/build-image.yml@v8.0.5
1212
with:
1313
repo_owner: "thespad"
1414
app_name: "py-kms"

.github/workflows/call-check-and-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
call-workflow:
10-
uses: thespad/actions/.github/workflows/check-and-release.yml@v8
10+
uses: thespad/actions/.github/workflows/check-and-release.yml@v8.0.5
1111
with:
1212
repo_owner: "thespad"
1313
app_name: "py-kms"

Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ghcr.io/linuxserver/baseimage-alpine:3.19
3+
FROM ghcr.io/linuxserver/baseimage-alpine:3.21
44

55
# set version label
66
ARG BUILD_DATE
@@ -17,7 +17,7 @@ ENV PYTHONIOENCODING=utf-8 \
1717
VIRTUAL_ENV=/pyenv \
1818
PATH="/pyenv/bin:$PATH"
1919

20-
RUN \
20+
RUN --mount=type=bind,source=/patch,target=/patch \
2121
apk add --no-cache --update --virtual=build-dependencies \
2222
build-base \
2323
git \
@@ -34,7 +34,9 @@ RUN \
3434
setuptools \
3535
wheel && \
3636
pip install -U --no-cache-dir pytz && \
37-
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.19 -r /home/py-kms/requirements.txt && \
37+
pip install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine-3.21 -r /home/py-kms/requirements.txt && \
38+
patch /home/py-kms/pykms_PidGenerator.py < /patch/pykms_PidGenerator.patch && \
39+
patch /home/py-kms/KmsDataBase.xml < /patch/KmsDataBase.patch && \
3840
printf "Version: ${VERSION}\nBuild-date: ${BUILD_DATE}" > /build_version && \
3941
apk del --purge \
4042
build-dependencies && \

README.md

+54-3
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,22 @@ The architectures supported by this image are:
3232

3333
More info at [py-kms](https://github.com/Py-KMS-Organization/py-kms).
3434

35+
## Read-Only Operation
36+
37+
This image can be run with a read-only container filesystem.
38+
39+
Running the container read-only requires mounting `/run` to tmpfs with the `exec` flag.
40+
41+
## Non-Root Operation
42+
43+
This image can be run with a non-root user.
44+
3545
## Usage
3646

3747
Here are some example snippets to help you get started creating a container.
3848

3949
### docker-compose ([recommended](https://docs.linuxserver.io/general/docker-compose))
4050

41-
Compatible with docker-compose v2 schemas.
42-
4351
```yaml
4452
---
4553
services:
@@ -104,12 +112,55 @@ In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as bel
104112
* Shell access whilst the container is running: `docker exec -it py-kms /bin/bash`
105113
* To monitor the logs of the container in realtime: `docker logs -f py-kms`
106114

115+
## Updating Info
116+
117+
Most of our images are static, versioned, and require an image update and container recreation to update the app inside. We do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image.
118+
119+
Below are the instructions for updating containers:
120+
121+
### Via Docker Compose
122+
123+
* Update all images: `docker-compose pull`
124+
* or update a single image: `docker-compose pull py-kms`
125+
* Let compose update all containers as necessary: `docker-compose up -d`
126+
* or update a single container: `docker-compose up -d py-kms`
127+
* You can also remove the old dangling images: `docker image prune`
128+
129+
### Via Docker Run
130+
131+
* Update the image: `docker pull ghcr.io/thespad/py-kms`
132+
* Stop the running container: `docker stop py-kms`
133+
* Delete the container: `docker rm py-kms`
134+
* Recreate a new container with the same docker run parameters as instructed above (if mapped correctly to a host folder, your `/config` folder and settings will be preserved)
135+
* You can also remove the old dangling images: `docker image prune`
136+
107137
### Image Update Notifications - Diun (Docker Image Update Notifier)
108138

109-
* We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
139+
>[!TIP]
140+
>We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported.
141+
142+
## Building locally
143+
144+
If you want to make local modifications to these images for development purposes or just to customize the logic:
145+
146+
```shell
147+
git clone https://github.com/thespad/docker-py-kms.git
148+
cd docker-py-kms
149+
docker build \
150+
--no-cache \
151+
--pull \
152+
-t ghcr.io/thespad/py-kms:latest .
153+
```
154+
155+
The arm variants can be built on x86_64 hardware and vice versa using `lscr.io/linuxserver/qemu-static`
156+
157+
```bash
158+
docker run --rm --privileged lscr.io/linuxserver/qemu-static --reset
159+
```
110160

111161
## Versions
112162

163+
* **02.02.25:** - Rebase to Alpine 3.21. Patch support for Python 3.21.
113164
* **13.11.24:** - Revert to Alpine 3.19 & Python 3.11 to fix bug with Win 11 and Office activations.
114165
* **26.05.24:** - Rebase to Alpine 3.20.
115166
* **30.12.23:** - Rebase to Alpine 3.19.

patch/KmsDataBase.patch

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--- KmsDataBase.xml 2025-02-02 14:24:00.000000000 +0000
2+
+++ KmsDataBase.xml_new.xml 2025-02-02 14:31:01.359088569 +0000
3+
@@ -103,10 +103,22 @@
4+
<Activate KmsItem="7ba0bf23-d0f5-4072-91d9-d55af5a481b6" />
5+
</CsvlkItem>
6+
7+
- <CsvlkItem DisplayName="Windows Server 2022" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" EPid="06401-00206-566-174993-03-1033-9600.0000-2802018" Id="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" InvalidWinBuild="[0,1,2]">
8+
+ <CsvlkItem DisplayName="Windows Server 2025 Datacenter" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" Id="c052f164-cdf6-409a-a0cb-853ba0f0f55a" InvalidWinBuild="[0,1,2]">
9+
+ <Activate KmsItem="c052f164-cdf6-409a-a0cb-853ba0f0f55a" />
10+
+ </CsvlkItem>
11+
+
12+
+ <CsvlkItem DisplayName="Windows Server 2025 Standard" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" Id="7dc26449-db21-4e09-ba37-28f2958506a6" InvalidWinBuild="[0,1,2]">
13+
+ <Activate KmsItem="7dc26449-db21-4e09-ba37-28f2958506a6" />
14+
+ </CsvlkItem>
15+
+
16+
+ <CsvlkItem DisplayName="Windows Server 2022 Datacenter" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" Id="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" InvalidWinBuild="[0,1,2]">
17+
<Activate KmsItem="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" />
18+
</CsvlkItem>
19+
20+
+ <CsvlkItem DisplayName="Windows Server 2022 Standard" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" Id="de32eafd-aaee-4662-9444-c1befb41bde2" InvalidWinBuild="[0,1,2]">
21+
+ <Activate KmsItem="de32eafd-aaee-4662-9444-c1befb41bde2" />
22+
+ </CsvlkItem>
23+
+
24+
<CsvlkItem DisplayName="Windows Server 2019" VlmcsdIndex="0" GroupId="206" MinKeyId="551000000" MaxKeyId="570999999" IniFileName="Windows" EPid="06401-00206-566-174993-03-1033-9600.0000-2802018" Id="2e7a9ad1-a849-4b56-babe-17d5a29fe4b4" InvalidWinBuild="[0,1,2]">
25+
<Activate KmsItem="58e2134f-8e11-4d17-9cb2-91069c151148" />
26+
<Activate KmsItem="7fde5219-fbfa-484a-82c9-34d1ad53e856" />
27+
@@ -568,8 +580,19 @@
28+
29+
<AppItem DisplayName="Windows" VlmcsdIndex="0" Id="55c92734-d682-4d71-983e-d6ec3f16059f" MinActiveClients="50">
30+
31+
- <KmsItem DisplayName="Windows Server 2022" Id="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" DefaultKmsProtocol="6.0" NCountPolicy="5">
32+
+ <KmsItem DisplayName="Windows Server 2025 Datacenter" Id="c052f164-cdf6-409a-a0cb-853ba0f0f55a" DefaultKmsProtocol="6.0" NCountPolicy="5">
33+
+ <SkuItem DisplayName="Windows Server 2025 Datacenter" Id="c052f164-cdf6-409a-a0cb-853ba0f0f55a" Gvlk="D764K-2NDRG-47T6Q-P8T8W-YP6DF" />
34+
+ </KmsItem>
35+
+
36+
+ <KmsItem DisplayName="Windows Server 2025 Standard" Id="7dc26449-db21-4e09-ba37-28f2958506a6" DefaultKmsProtocol="6.0" NCountPolicy="5">
37+
+ <SkuItem DisplayName="Windows Server 2025 Standard" Id="7dc26449-db21-4e09-ba37-28f2958506a6" Gvlk="TVRH6-WHNXV-R9WG3-9XRFY-MY832" />
38+
+ </KmsItem>
39+
+
40+
+ <KmsItem DisplayName="Windows Server 2022 Datacenter" Id="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" DefaultKmsProtocol="6.0" NCountPolicy="5">
41+
<SkuItem DisplayName="Windows Server 2022 Datacenter" Id="ef6cfc9f-8c5d-44ac-9aad-de6a2ea0ae03" Gvlk="WX4NM-KYWYW-QJJR4-XV3QB-6VM33" />
42+
+ </KmsItem>
43+
+
44+
+ <KmsItem DisplayName="Windows Server 2022 Standard" Id="de32eafd-aaee-4662-9444-c1befb41bde2" DefaultKmsProtocol="6.0" NCountPolicy="5">
45+
<SkuItem DisplayName="Windows Server 2022 Standard" Id="de32eafd-aaee-4662-9444-c1befb41bde2" Gvlk="VDYBN-27WPP-V4HQT-9VMD4-VMK7H" />
46+
</KmsItem>
47+

patch/pykms_PidGenerator.patch

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- /home/py-kms/pykms_PidGenerator.py
2+
+++ /home/py-kms/pykms_PidGenerator_patched.py
3+
@@ -59,7 +59,7 @@
4+
minTime = datetime.date(d.year, d.month, d.day)
5+
6+
# Generate Year and Day Number
7+
- randomDate = datetime.date.fromtimestamp(random.randint(time.mktime(minTime.timetuple()), time.mktime(datetime.datetime.now().timetuple())))
8+
+ randomDate = datetime.date.fromtimestamp(random.randint(int(time.mktime(minTime.timetuple())), int(time.mktime(datetime.datetime.now().timetuple()))))
9+
firstOfYear = datetime.date(randomDate.year, 1, 1)
10+
randomDayNumber = int((time.mktime(randomDate.timetuple()) - time.mktime(firstOfYear.timetuple())) / 86400 + 0.5)

0 commit comments

Comments
 (0)