mirror of
https://github.com/11notes/docker-kms.git
synced 2025-10-23 04:52:15 +00:00
switch to new github workflow and build process
This commit is contained in:
158
.github/workflows/docker.yml
vendored
Normal file
158
.github/workflows/docker.yml
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
name: create and publish docker image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
DOCKER_USERNAME: 11notes
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: init / checkout
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
|
||||
- name: init / .json to env
|
||||
uses: rgarcia-phi/json-to-variables@9835d537368468c4e4de5254dc3efeadda183793
|
||||
with:
|
||||
filename: '.json'
|
||||
|
||||
- name: init / setup environment
|
||||
run: |
|
||||
: # set default arch if not set
|
||||
echo "IMAGE_ARCH=${json_arch:-linux/amd64,linux/arm64}" >> $GITHUB_ENV
|
||||
|
||||
: # create tags for semver, stable and other shenanigans
|
||||
export LOCAL_SHA=$(git rev-parse --short HEAD)
|
||||
export LOCAL_SEMVER_MAJOR=$(awk -F. '{ print $1 }' <<< ${json_version})
|
||||
export LOCAL_SEMVER_MINOR=$(awk -F. '{ print $2 }' <<< ${json_version})
|
||||
export LOCAL_SEMVER_PATCH=$(awk -F. '{ print $3 }' <<< ${json_version})
|
||||
export LOCAL_TAGS="${json_image}:latest"
|
||||
if [ ! -z ${LOCAL_SEMVER_MAJOR} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}"; fi
|
||||
if [ ! -z ${LOCAL_SEMVER_MINOR} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}.${LOCAL_SEMVER_MINOR}"; fi
|
||||
if [ ! -z ${LOCAL_SEMVER_PATCH} ]; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SEMVER_MAJOR}.${LOCAL_SEMVER_MINOR}.${LOCAL_SEMVER_PATCH}"; fi
|
||||
if echo "${LOCAL_TAGS}" | grep -q "${json_stable}" ; then LOCAL_TAGS="${LOCAL_TAGS},${json_image}:stable"; fi
|
||||
if [ ! -z ${json_tags} ]; then SPECIAL_LOCAL_TAGS=$(echo ${json_tags} | sed 's/,/ /g'); for LOCAL_TAG in ${json_tags}; do LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_TAG}"; done; fi
|
||||
LOCAL_TAGS="${LOCAL_TAGS},${json_image}:${LOCAL_SHA}"
|
||||
echo "IMAGE_TAGS=${LOCAL_TAGS}" >> $GITHUB_ENV
|
||||
|
||||
: # if for whatever reason UID/GID must be changed at build time
|
||||
echo "IMAGE_UID=${json_uid:-1000}" >> $GITHUB_ENV
|
||||
echo "IMAGE_GID=${json_gid:-1000}" >> $GITHUB_ENV
|
||||
|
||||
- name: docker / login to hub
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
|
||||
with:
|
||||
username: ${{ env.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: docker / setup qemu
|
||||
uses: docker/setup-qemu-action@53851d14592bedcffcf25ea515637cff71ef929a
|
||||
|
||||
- name: docker / setup buildx
|
||||
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5
|
||||
|
||||
- name: grype / build & push
|
||||
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
|
||||
with:
|
||||
context: .
|
||||
file: arch.dockerfile
|
||||
push: true
|
||||
platforms: ${{ env.IMAGE_ARCH }}
|
||||
cache-from: type=registry,ref=${{ env.json_image }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.json_image }}:buildcache,mode=max,compression=zstd,force-compression=true
|
||||
build-args: |
|
||||
APP_IMAGE=${{ env.json_image }}
|
||||
APP_NAME=${{ env.json_name }}
|
||||
APP_VERSION=${{ env.json_version }}
|
||||
APP_ROOT=${{ env.json_root }}
|
||||
APP_UID=${{ env.IMAGE_UID }}
|
||||
APP_GID=${{ env.IMAGE_GID }}
|
||||
tags: |
|
||||
${{ env.json_image }}:grype
|
||||
|
||||
- name: grype / scan
|
||||
id: scan
|
||||
uses: anchore/scan-action@abae793926ec39a78ab18002bc7fc45bbbd94342
|
||||
with:
|
||||
image: ${{ env.json_image }}:grype
|
||||
severity-cutoff: high
|
||||
|
||||
- name: grype / delete tag
|
||||
if: success() || failure()
|
||||
run: |
|
||||
curl --request DELETE \
|
||||
--url https://hub.docker.com/v2/repositories/${{ env.json_image }}/tags/grype/ \
|
||||
--header 'authorization: jwt ${{ secrets.DOCKER_TOKEN }}' \
|
||||
--header 'content-type: application/json' \
|
||||
--fail
|
||||
|
||||
- name: grype / report / upload
|
||||
uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169
|
||||
with:
|
||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||
|
||||
- name: grype / report / print
|
||||
run: cat ${{ steps.scan.outputs.sarif }}
|
||||
|
||||
- name: docker / build & push
|
||||
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
|
||||
with:
|
||||
context: .
|
||||
file: arch.dockerfile
|
||||
push: true
|
||||
sbom: true
|
||||
provenance: mode=max
|
||||
platforms: ${{ env.IMAGE_ARCH }}
|
||||
cache-from: type=registry,ref=${{ env.json_image }}:buildcache
|
||||
cache-to: type=registry,ref=${{ env.json_image }}:buildcache,mode=max,compression=zstd,force-compression=true
|
||||
build-args: |
|
||||
APP_IMAGE=${{ env.json_image }}
|
||||
APP_NAME=${{ env.json_name }}
|
||||
APP_VERSION=${{ env.json_version }}
|
||||
APP_ROOT=${{ env.json_root }}
|
||||
APP_UID=${{ env.IMAGE_UID }}
|
||||
APP_GID=${{ env.IMAGE_GID }}
|
||||
tags: |
|
||||
${{ env.IMAGE_TAGS }}
|
||||
|
||||
- name: github / create release notes
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh release create ${{ github.ref_name }} -F RELEASE.md
|
||||
|
||||
- name: github / update description and set repo defaults
|
||||
run: |
|
||||
curl --request PATCH \
|
||||
--url https://api.github.com/repos/${{ github.repository }} \
|
||||
--header 'authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}' \
|
||||
--header 'content-type: application/json' \
|
||||
--data '{
|
||||
"description":"${{ env.json_description }}",
|
||||
"homepage":"",
|
||||
"has_issues":true,
|
||||
"has_discussions":true,
|
||||
"has_projects":false,
|
||||
"has_wiki":false
|
||||
}' \
|
||||
--fail
|
||||
|
||||
- name: docker / push README.md to docker hub
|
||||
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8
|
||||
env:
|
||||
DOCKER_USER: ${{ env.DOCKER_USERNAME }}
|
||||
DOCKER_PASS: ${{ secrets.DOCKER_TOKEN }}
|
||||
with:
|
||||
destination_container_repo: ${{ env.json_image }}
|
||||
provider: dockerhub
|
||||
short_description: ${{ env.json_description }}
|
||||
readme_file: 'README.md'
|
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: create release notes
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
- "!amd64*"
|
||||
- "!arm64*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: create release notes
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
tag: ${{ github.ref_name }}
|
||||
run: |
|
||||
gh release create "$tag" \
|
||||
--repo="$GITHUB_REPOSITORY" \
|
||||
--title="${tag#v}" \
|
||||
--generate-notes
|
10
.json
Normal file
10
.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"image":"11notes/kms",
|
||||
"description":"Activate any version of Windows and Office, forever",
|
||||
"name":"kms",
|
||||
"version":"646f476",
|
||||
"root":"/kms",
|
||||
|
||||
"stable":"646f476",
|
||||
"parent":"11notes/alpine:stable"
|
||||
}
|
21
LICENSE
21
LICENSE
@@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 11notes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
53
README.md
53
README.md
@@ -1,14 +1,13 @@
|
||||

|
||||
|
||||
# 🏔️ Alpine - kms
|
||||
[<img src="https://img.shields.io/badge/github-source-blue?logo=github">](https://github.com/11notes/docker-kms/tree/latest)   
|
||||
# 🏔️ kms on Alpine
|
||||
[<img src="https://img.shields.io/badge/github-source-blue?logo=github&color=040308">](https://github.com/11notes/docker-kms)[<img src="https://img.shields.io/github/issues/11notes/docker-kms?color=7842f5">](https://github.com/11notes/docker-kms/issues)
|
||||
|
||||
**Activate any version of Windows and Office, forever**
|
||||
|
||||

|
||||

|
||||
|
||||
# SYNOPSIS
|
||||
# SYNOPSIS 📖
|
||||
**What can I do with this?** This image will run a KMS server you can use to activate any version of Windows and Office, forever.
|
||||
|
||||
Works with:
|
||||
@@ -33,15 +32,15 @@ Works with:
|
||||
- Microsoft Office 2021 ( Volume License )
|
||||
- Microsoft Office 2024 ( Volume License )
|
||||
|
||||
# VOLUMES
|
||||
# VOLUMES 📁
|
||||
* **/kms/var** - Directory of the activation database
|
||||
|
||||
# COMPOSE
|
||||
# COMPOSE ✂️
|
||||
```yaml
|
||||
name: "kms"
|
||||
services:
|
||||
kms:
|
||||
image: "11notes/kms:latest"
|
||||
image: "11notes/kms:646f476"
|
||||
container_name: "kms"
|
||||
environment:
|
||||
TZ: Europe/Zurich
|
||||
@@ -50,21 +49,11 @@ services:
|
||||
ports:
|
||||
- "1688:1688/tcp"
|
||||
restart: always
|
||||
whodb:
|
||||
image: "11notes/whodb:latest"
|
||||
container_name: "whodb"
|
||||
environment:
|
||||
TZ: Europe/Zurich
|
||||
volumes:
|
||||
- "var:/whodb/var"
|
||||
ports:
|
||||
- "8080:8080/tcp"
|
||||
restart: always
|
||||
volumes:
|
||||
var:
|
||||
```
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
## Windows Server 2025 Datacenter. List of [GVLK](https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys)
|
||||
```cmd
|
||||
slmgr /ipk D764K-2NDRG-47T6Q-P8T8W-YP6DF
|
||||
@@ -81,20 +70,20 @@ Activate server
|
||||
slmgr /ato
|
||||
```
|
||||
|
||||
# DEFAULT SETTINGS
|
||||
# DEFAULT SETTINGS 🗃️
|
||||
| Parameter | Value | Description |
|
||||
| --- | --- | --- |
|
||||
| `user` | docker | user docker |
|
||||
| `uid` | 1000 | user id 1000 |
|
||||
| `gid` | 1000 | group id 1000 |
|
||||
| `user` | docker | user name |
|
||||
| `uid` | 1000 | [user identifier](https://en.wikipedia.org/wiki/User_identifier) |
|
||||
| `gid` | 1000 | [group identifier](https://en.wikipedia.org/wiki/Group_identifier) |
|
||||
| `home` | /kms | home directory of user docker |
|
||||
| `database` | /kms/var/kms.db | SQlite database holding all client data |
|
||||
|
||||
# ENVIRONMENT
|
||||
# ENVIRONMENT 📝
|
||||
| Parameter | Value | Default |
|
||||
| --- | --- | --- |
|
||||
| `TZ` | [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | |
|
||||
| `DEBUG` | Show debug information | |
|
||||
| `DEBUG` | Show debug messages from image **not** app | |
|
||||
| `KMS_IP` | localhost or 127.0.0.1 or a dedicated IP | 0.0.0.0 |
|
||||
| `KMS_PORT` | any port > 1024 | 1688 |
|
||||
| `KMS_LOCALE` | see Microsoft LICD specification | 1033 (en-US) |
|
||||
@@ -103,20 +92,20 @@ slmgr /ato
|
||||
| `KMS_RENEWALINTERVAL` | re-activation after N minutes | 259200 (180 days) |
|
||||
| `KMS_LOGLEVEL` | CRITICAL, ERROR, WARNING, INFO, DEBUG, MININFO | INFO |
|
||||
|
||||
# SOURCE
|
||||
* [11notes/kms:latest](https://github.com/11notes/docker-kms/tree/latest)
|
||||
# SOURCE 💾
|
||||
* [11notes/kms](https://github.com/11notes/docker-kms)
|
||||
|
||||
# PARENT IMAGE
|
||||
# PARENT IMAGE 🏛️
|
||||
* [11notes/alpine:stable](https://hub.docker.com/r/11notes/alpine)
|
||||
|
||||
# BUILT WITH
|
||||
# BUILT WITH 🧰
|
||||
* [py-kms](https://github.com/Py-KMS-Organization/py-kms)
|
||||
* [alpine](https://alpinelinux.org)
|
||||
|
||||
# TIPS
|
||||
* Use a reverse proxy like Traefik, Nginx to terminate TLS with a valid certificate
|
||||
# TIPS 📌
|
||||
* Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS with a valid certificate
|
||||
* Use Let’s Encrypt certificates to protect your SSL endpoints
|
||||
* [Microsoft LICD](https://learn.microsoft.com/en-us/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a)
|
||||
|
||||
# ElevenNotes<sup>™️</sup>
|
||||
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [RELEASE.md](https://github.com/11notes/docker-kms/blob/latest/RELEASE.md) for breaking changes. You can find all my repositories on [github](https://github.com/11notes).
|
||||
# ElevenNotes™️
|
||||
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-kms/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-kms/issues), thanks . You can find all my repositories on [github](https://github.com/11notes?tab=repositories).
|
2
RELEASE.md
Normal file
2
RELEASE.md
Normal file
@@ -0,0 +1,2 @@
|
||||
### 🪄 Features
|
||||
* switch to new github workflow and build process
|
@@ -1,95 +0,0 @@
|
||||
# :: Util
|
||||
FROM alpine as util
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache \
|
||||
git; \
|
||||
git clone https://github.com/11notes/util.git;
|
||||
|
||||
# :: Build
|
||||
FROM alpine as build
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --update --no-cache \
|
||||
curl \
|
||||
wget \
|
||||
unzip \
|
||||
build-base \
|
||||
linux-headers \
|
||||
make \
|
||||
cmake \
|
||||
g++ \
|
||||
git; \
|
||||
git clone https://github.com/Py-KMS-Organization/py-kms.git /tmp/py-kms; \
|
||||
mv /tmp/py-kms/py-kms /usr/local/bin;
|
||||
|
||||
# :: Header
|
||||
FROM python:3.11-alpine
|
||||
COPY --from=build /usr/local/bin/ /usr/local/bin
|
||||
COPY --from=util /util/docker /usr/local/bin
|
||||
ENV APP_ROOT=/kms
|
||||
ENV APP_NAME="kms"
|
||||
ENV APP_VERSION="latest"
|
||||
ENV KMS_IP=0.0.0.0
|
||||
ENV KMS_PORT=1688
|
||||
ENV KMS_LOCALE=1033
|
||||
ENV KMS_CLIENTCOUNT=25
|
||||
ENV KMS_ACTIVATIONINTERVAL=120
|
||||
ENV KMS_RENEWALINTERVAL=259200
|
||||
ENV KMS_LOGLEVEL="INFO"
|
||||
|
||||
# :: Run
|
||||
USER root
|
||||
|
||||
# :: update image
|
||||
RUN set -ex; \
|
||||
apk --no-cache --update add \
|
||||
curl \
|
||||
tzdata \
|
||||
shadow; \
|
||||
apk --no-cache upgrade;
|
||||
|
||||
# :: prepare image
|
||||
RUN set -ex; \
|
||||
mkdir -p ${APP_ROOT}; \
|
||||
mkdir -p ${APP_ROOT}/var; \
|
||||
touch /var/log/kms.log; \
|
||||
ln -sf /dev/stdout /var/log/kms.log;
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache \
|
||||
py3-configargparse \
|
||||
py3-pygments \
|
||||
python3-tkinter \
|
||||
sqlite-libs \
|
||||
python3-dev \
|
||||
sqlite-dev \
|
||||
gcc \
|
||||
musl-dev \
|
||||
py3-pip; \
|
||||
pip3 install --no-cache-dir \
|
||||
peewee \
|
||||
tzlocal \
|
||||
pytz \
|
||||
pysqlite3;
|
||||
|
||||
# :: create user
|
||||
RUN set -ex; \
|
||||
addgroup --gid 1000 -S docker; \
|
||||
adduser --uid 1000 -D -S -h / -s /sbin/nologin -G docker docker;
|
||||
|
||||
# :: copy root filesystem changes and set correct permissions
|
||||
COPY ./rootfs /
|
||||
RUN set -ex; \
|
||||
chmod +x -R /usr/local/bin; \
|
||||
usermod -d ${APP_ROOT} docker; \
|
||||
chown -R 1000:1000 \
|
||||
${APP_ROOT} \
|
||||
/var/log/kms.log;
|
||||
|
||||
# :: Volumes
|
||||
VOLUME ["${APP_ROOT}/var"]
|
||||
|
||||
# :: Start
|
||||
USER docker
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
91
arch.dockerfile
Normal file
91
arch.dockerfile
Normal file
@@ -0,0 +1,91 @@
|
||||
# :: Util
|
||||
FROM alpine AS util
|
||||
|
||||
RUN set -ex; \
|
||||
apk --no-cache --update add \
|
||||
git; \
|
||||
git clone https://github.com/11notes/docker-util.git;
|
||||
|
||||
# :: Build / redis
|
||||
FROM python:3.12-alpine AS build
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG APP_VERSION
|
||||
|
||||
USER root
|
||||
|
||||
RUN set -ex; \
|
||||
apk --update --no-cache add \
|
||||
curl \
|
||||
wget \
|
||||
unzip \
|
||||
build-base \
|
||||
linux-headers \
|
||||
make \
|
||||
cmake \
|
||||
g++ \
|
||||
git; \
|
||||
pip3 install --upgrade pip; \
|
||||
pip3 install pyinstaller; \
|
||||
git clone https://github.com/Py-KMS-Organization/py-kms.git; \
|
||||
cd /py-kms/py-kms; \
|
||||
git checkout ${APP_VERSION}; \
|
||||
pyinstaller --onefile pykms_Server.py; \
|
||||
cp /py-kms/py-kms/dist/pykms_Server /usr/local/bin;
|
||||
|
||||
# :: Header
|
||||
FROM 11notes/alpine:stable
|
||||
|
||||
# :: arguments
|
||||
ARG TARGETARCH
|
||||
ARG APP_IMAGE
|
||||
ARG APP_NAME
|
||||
ARG APP_VERSION
|
||||
ARG APP_ROOT
|
||||
|
||||
# :: environment
|
||||
ENV APP_IMAGE=${APP_IMAGE}
|
||||
ENV APP_NAME=${APP_NAME}
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
ENV APP_ROOT=${APP_ROOT}
|
||||
|
||||
ENV KMS_IP=0.0.0.0
|
||||
ENV KMS_PORT=1688
|
||||
ENV KMS_LOCALE=1033
|
||||
ENV KMS_CLIENTCOUNT=25
|
||||
ENV KMS_ACTIVATIONINTERVAL=120
|
||||
ENV KMS_RENEWALINTERVAL=259200
|
||||
ENV KMS_LOGLEVEL="INFO"
|
||||
|
||||
# :: multi-stage
|
||||
COPY --from=util /docker-util/src/ /usr/local/bin
|
||||
COPY --from=build /usr/local/bin/ /usr/local/bin
|
||||
|
||||
# :: Run
|
||||
USER root
|
||||
|
||||
# :: install application
|
||||
RUN set -ex; \
|
||||
apk --no-cache --update add \
|
||||
python3;
|
||||
|
||||
RUN set -ex; \
|
||||
mkdir -p ${APP_ROOT}/var; \
|
||||
touch /var/log/kms.log; \
|
||||
ln -sf /dev/stdout /var/log/kms.log;
|
||||
|
||||
# :: copy filesystem changes and set correct permissions
|
||||
COPY ./rootfs /
|
||||
RUN set -ex; \
|
||||
chmod +x -R /usr/local/bin; \
|
||||
chown -R 1000:1000 \
|
||||
${APP_ROOT};
|
||||
|
||||
# :: Volumes
|
||||
VOLUME ["${APP_ROOT}/var"]
|
||||
|
||||
# :: Monitor
|
||||
HEALTHCHECK --interval=5s --timeout=2s CMD /usr/local/bin/healthcheck.sh || exit 1
|
||||
|
||||
# :: Start
|
||||
USER docker
|
@@ -1,100 +0,0 @@
|
||||
# :: QEMU
|
||||
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
|
||||
|
||||
# :: Util
|
||||
FROM alpine as util
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache \
|
||||
git; \
|
||||
git clone https://github.com/11notes/util.git;
|
||||
|
||||
# :: Build
|
||||
FROM --platform=linux/arm64 alpine as build
|
||||
COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --update --no-cache \
|
||||
curl \
|
||||
wget \
|
||||
unzip \
|
||||
build-base \
|
||||
linux-headers \
|
||||
make \
|
||||
cmake \
|
||||
g++ \
|
||||
git; \
|
||||
git clone https://github.com/Py-KMS-Organization/py-kms.git /tmp/py-kms; \
|
||||
mv /tmp/py-kms/py-kms /usr/local/bin;
|
||||
|
||||
# :: Header
|
||||
FROM --platform=linux/arm64 arm64v8/python:3.11-alpine
|
||||
COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin
|
||||
COPY --from=build /usr/local/bin/ /usr/local/bin
|
||||
COPY --from=util /util/docker /usr/local/bin
|
||||
ENV APP_ROOT=/kms
|
||||
ENV APP_NAME="kms"
|
||||
ENV APP_VERSION="latest"
|
||||
ENV KMS_IP=0.0.0.0
|
||||
ENV KMS_PORT=1688
|
||||
ENV KMS_LOCALE=1033
|
||||
ENV KMS_CLIENTCOUNT=25
|
||||
ENV KMS_ACTIVATIONINTERVAL=120
|
||||
ENV KMS_RENEWALINTERVAL=259200
|
||||
ENV KMS_LOGLEVEL="INFO"
|
||||
|
||||
# :: Run
|
||||
USER root
|
||||
|
||||
# :: update image
|
||||
RUN set -ex; \
|
||||
apk --no-cache --update add \
|
||||
curl \
|
||||
tzdata \
|
||||
shadow; \
|
||||
apk --no-cache upgrade;
|
||||
|
||||
# :: prepare image
|
||||
RUN set -ex; \
|
||||
mkdir -p ${APP_ROOT}; \
|
||||
mkdir -p ${APP_ROOT}/var; \
|
||||
touch /var/log/kms.log; \
|
||||
ln -sf /dev/stdout /var/log/kms.log;
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache \
|
||||
py3-configargparse \
|
||||
py3-pygments \
|
||||
python3-tkinter \
|
||||
sqlite-libs \
|
||||
python3-dev \
|
||||
sqlite-dev \
|
||||
gcc \
|
||||
musl-dev \
|
||||
py3-pip; \
|
||||
pip3 install --no-cache-dir \
|
||||
peewee \
|
||||
tzlocal \
|
||||
pytz \
|
||||
pysqlite3;
|
||||
|
||||
# :: create user
|
||||
RUN set -ex; \
|
||||
addgroup --gid 1000 -S docker; \
|
||||
adduser --uid 1000 -D -S -h / -s /sbin/nologin -G docker docker;
|
||||
|
||||
# :: copy root filesystem changes and set correct permissions
|
||||
COPY ./rootfs /
|
||||
RUN set -ex; \
|
||||
chmod +x -R /usr/local/bin; \
|
||||
usermod -d ${APP_ROOT} docker; \
|
||||
chown -R 1000:1000 \
|
||||
${APP_ROOT} \
|
||||
/var/log/kms.log;
|
||||
|
||||
# :: Volumes
|
||||
VOLUME ["${APP_ROOT}/var"]
|
||||
|
||||
# :: Start
|
||||
USER docker
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
12
compose.yaml
12
compose.yaml
@@ -1,7 +1,7 @@
|
||||
name: "kms"
|
||||
services:
|
||||
kms:
|
||||
image: "11notes/kms:latest"
|
||||
image: "11notes/kms:646f476"
|
||||
container_name: "kms"
|
||||
environment:
|
||||
TZ: Europe/Zurich
|
||||
@@ -10,15 +10,5 @@ services:
|
||||
ports:
|
||||
- "1688:1688/tcp"
|
||||
restart: always
|
||||
whodb:
|
||||
image: "11notes/whodb:latest"
|
||||
container_name: "whodb"
|
||||
environment:
|
||||
TZ: Europe/Zurich
|
||||
volumes:
|
||||
- "var:/whodb/var"
|
||||
ports:
|
||||
- "8080:8080/tcp"
|
||||
restart: always
|
||||
volumes:
|
||||
var:
|
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v0.9.0/manifest-tool-linux-amd64
|
||||
chmod +x manifest-tool
|
||||
./manifest-tool push from-spec multi-arch-manifest-latest.yaml
|
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
docker run --rm --privileged multiarch/qemu-user-static:register --reset
|
@@ -1,11 +0,0 @@
|
||||
image: 11notes/kms:latest
|
||||
manifests:
|
||||
- image: 11notes/kms:amd64-latest
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: 11notes/kms:arm64v8-latest
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
@@ -1,8 +1,7 @@
|
||||
#!/bin/ash
|
||||
if [ -z "${1}" ]; then
|
||||
elevenLogJSON info "starting ${APP_NAME}"
|
||||
set -- "python3" \
|
||||
/usr/local/bin/py-kms/pykms_Server.py \
|
||||
eleven log start
|
||||
set -- "pykms_Server" \
|
||||
${KMS_IP} \
|
||||
${KMS_PORT} \
|
||||
-l ${KMS_LOCALE} \
|
||||
|
2
rootfs/usr/local/bin/healthcheck.sh
Normal file
2
rootfs/usr/local/bin/healthcheck.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/ash
|
||||
netstat -an | grep -q ${KMS_PORT}
|
Reference in New Issue
Block a user