Docker multiarch (#93)

* Reshot screenshots on an english system (also added GIMP files)

* Added multiarch to minimal

* Added amd64 suffix

* Stripped down file (comments are inside the README anyways)

* Added python3 multiarch

* Corrected missing arch specs

* Added older arm version

* Added architecture explanation

* Pointed manifests to official image

* Removed xcfc files as requested in https://github.com/SystemRage/py-kms/pull/93#issuecomment-694937260
This commit is contained in:
Simonmicro 2020-10-03 22:15:48 +02:00 committed by GitHub
parent dda3c680eb
commit 5ffcbb8606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 425 additions and 125 deletions

View File

@ -1,6 +1,6 @@
# This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size
FROM alpine:3.8
FROM alpine:3.12
ENV IP 0.0.0.0
ENV PORT 1688

View File

@ -0,0 +1,44 @@
# This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-arm.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm32v6/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-arm-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV HWID "RANDOM"
ENV LOGLEVEL INFO
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
pip3 install peewee tzlocal && \
git clone https://github.com/SystemRage/py-kms/ /tmp/py-kms && \
mv /tmp/py-kms/py-kms /home/ && \
rm -rf /tmp/py-kms && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}

View File

@ -0,0 +1,44 @@
# This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-arm.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm32v7/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-arm-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV HWID "RANDOM"
ENV LOGLEVEL INFO
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
pip3 install peewee tzlocal && \
git clone https://github.com/SystemRage/py-kms/ /tmp/py-kms && \
mv /tmp/py-kms/py-kms /home/ && \
rm -rf /tmp/py-kms && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}

View File

@ -0,0 +1,44 @@
# This is a minimized version from docker/docker-py3-kms/Dockerfile without SQLite support to further reduce image size
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-aarch64.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm64v8/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-aarch64-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV HWID "RANDOM"
ENV LOGLEVEL INFO
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
pip3 install peewee tzlocal && \
git clone https://github.com/SystemRage/py-kms/ /tmp/py-kms && \
mv /tmp/py-kms/py-kms /home/ && \
rm -rf /tmp/py-kms && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT /usr/bin/python3 pykms_Server.py ${IP} ${PORT} -l ${LCID} -c ${CLIENT_COUNT} -a ${ACTIVATION_INTERVAL} -r ${RENEWAL_INTERVAL} -w ${HWID} -V ${LOGLEVEL} -F ${LOGFILE}

View File

@ -0,0 +1,10 @@
#!/bin/bash
# Use manifest-tool to create the manifest, given the experimental
# "docker manifest" command isn't available yet on Docker Hub.
curl -Lo manifest-tool "https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64"
chmod +x manifest-tool
./manifest-tool push from-spec multi-arch-manifest-latest.yaml
./manifest-tool push from-spec multi-arch-manifest-minimal.yaml

View File

@ -0,0 +1,5 @@
#!/bin/bash
# Register qemu-*-static for all supported processors except the
# current one, but also remove all registered binfmt_misc before
docker run --rm --privileged multiarch/qemu-user-static:register --reset

View File

@ -0,0 +1,21 @@
image: pykmsorg/py-kms:latest
manifests:
- image: pykmsorg/py-kms:minimal-amd64
platform:
architecture: amd64
os: linux
- image: pykmsorg/py-kms:minimal-arm32v6
platform:
architecture: arm
os: linux
variant: v6
- image: pykmsorg/py-kms:minimal-arm32v7
platform:
architecture: arm
os: linux
variant: v7
- image: pykmsorg/py-kms:minimal-arm64v8
platform:
architecture: arm64
os: linux
variant: v8

View File

@ -0,0 +1,21 @@
image: pykmsorg/py-kms:minimal
manifests:
- image: pykmsorg/py-kms:minimal-amd64
platform:
architecture: amd64
os: linux
- image: pykmsorg/py-kms:minimal-arm32v6
platform:
architecture: arm
os: linux
variant: v6
- image: pykmsorg/py-kms:minimal-arm32v7
platform:
architecture: arm
os: linux
variant: v7
- image: pykmsorg/py-kms:minimal-arm64v8
platform:
architecture: arm64
os: linux
variant: v8

View File

@ -1,118 +0,0 @@
# Use Alpine Linux
FROM alpine:3.8
# Maintainer
#MAINTAINER Artur Petrov <artur@phpchain.ru>
# EN: Variables
# RU: Переменные
# EN: IP-address
# RU: IP-адрес
ENV IP 0.0.0.0
# The IP address to listen on. The default is "0.0.0.0" (all interfaces).
# EN: TCP-port
# RU: TCP-порт
ENV PORT 1688
# The network port to listen on. The default is "1688".
# EN: ePID
# RU: ePID
ENV EPID ""
# Use this flag to manually specify an ePID to use. If no ePID is specified, a random ePID will be generated.
# EN: lcid
# RU: lcid
ENV LCID 1033
# Use this flag to manually specify an LCID for use with randomly generated ePIDs. Default is 1033 (en-us).
# EN: the current client count
# RU: текущий счётчик запросов на активацию продуктов от Microsoft
ENV CLIENT_COUNT 26
# Use this flag to specify the current client count. Default is 26.
# A number >=25 is required to enable activation of client OSes; for server OSes and Office >=5.
# EN: the activation interval (in minutes)
# RU: интервал активации (в минутах)
ENV ACTIVATION_INTERVAL 120
# Use this flag to specify the activation interval (in minutes). Default is 120 minutes (2 hours).
# EN: the renewal interval (in minutes)
# RU: интервал обновления (в минутах)
ENV RENEWAL_INTERVAL 10080
# Use this flag to specify the renewal interval (in minutes). Default is 10080 minutes (7 days).
# EN: Use SQLITE
# RU: Использовать РСУБД SQLITE
ENV SQLITE false
# Use this flag to store request information from unique clients in an SQLite database.
# EN: hwid
# RU: hwid
ENV HWID "364F463A8863D35F"
# Use this flag to specify a HWID.
# The HWID must be an 16-character string of hex characters.
# The default is "364F463A8863D35F" or type "RANDOM" to auto generate the HWID.
# EN: log level ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
# RU: Уровень логирования ("CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG")
ENV LOGLEVEL ERROR
# Use this flag to set a Loglevel. The default is "ERROR".
# EN: log file
# RU: Лог-файл
ENV LOGFILE /var/log/pykms_logserver.log
# Use this flag to set an output Logfile. The default is "/var/log/pykms_logserver.log".
# EN: log file size in MB
# RU: Максимальный размер Лог-файл в мегабайтах
ENV LOGSIZE ""
# Use this flag to set a maximum size (in MB) to the output log file. Deactivated by default.
# EN: Startup script
# RU: Скрипт автозапуска
COPY start.sh /usr/bin/start.sh
# EN: Software installation
# RU: Установка программного обеспечения
RUN echo "http://dl-cdn.alpinelinux.org/alpine/v3.8/main" >> /etc/apk/repositories && \
apk update && \
apk upgrade && \
apk add --update \
bash \
git \
py3-argparse \
# py3-tz \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
# EN: Clone git-repo
# RU: Клонирование git-репозитория
git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal pysqlite3 && \
# EN: Change permissions
# RU: Меняем права доступа
chmod a+x /usr/bin/start.sh && \
# EN: Clear after install software
# RU: Очистка после установки программного обеспечения
apk del git
# Set Workdir
WORKDIR /home/py-kms
# Expose ports
EXPOSE ${PORT}/tcp
# Entry point
ENTRYPOINT ["/usr/bin/start.sh"]

View File

@ -0,0 +1,41 @@
FROM alpine:3.12
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV SQLITE false
ENV HWID "364F463A8863D35F"
ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
COPY start.sh /usr/bin/start.sh
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal pysqlite3 && \
chmod a+x /usr/bin/start.sh && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT ["/usr/bin/start.sh"]

View File

@ -0,0 +1,49 @@
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-arm.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm32v6/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-arm-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV SQLITE false
ENV HWID "364F463A8863D35F"
ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
COPY start.sh /usr/bin/start.sh
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal pysqlite3 && \
chmod a+x /usr/bin/start.sh && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT ["/usr/bin/start.sh"]

View File

@ -0,0 +1,49 @@
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-arm.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm32v7/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-arm-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV SQLITE false
ENV HWID "364F463A8863D35F"
ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
COPY start.sh /usr/bin/start.sh
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal pysqlite3 && \
chmod a+x /usr/bin/start.sh && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT ["/usr/bin/start.sh"]

View File

@ -0,0 +1,49 @@
# Prepare the multiarch env
FROM alpine AS builder
RUN apk add curl && curl -L "https://github.com/balena-io/qemu/releases/download/v4.0.0%2Bbalena2/qemu-4.0.0.balena2-aarch64.tar.gz" | tar zxvf - -C . --strip-components 1
# Switch to the target image
FROM arm64v8/alpine:3.12
# Import qemu from the preparation
COPY --from=builder qemu-aarch64-static /usr/bin
ENV IP 0.0.0.0
ENV PORT 1688
ENV EPID ""
ENV LCID 1033
ENV CLIENT_COUNT 26
ENV ACTIVATION_INTERVAL 120
ENV RENEWAL_INTERVAL 10080
ENV SQLITE false
ENV HWID "364F463A8863D35F"
ENV LOGLEVEL ERROR
ENV LOGFILE /var/log/pykms_logserver.log
ENV LOGSIZE ""
COPY start.sh /usr/bin/start.sh
RUN apk add --no-cache --update \
bash \
git \
py3-argparse \
py3-flask \
py3-pygments \
python3-tkinter \
sqlite-libs \
py3-pip && \
git clone https://github.com/SystemRage/py-kms.git /tmp/py-kms && \
git clone https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web && \
mv /tmp/py-kms/py-kms /home/ && \
mv /tmp/sqlite_web/sqlite_web /home/ && \
rm -rf /tmp/py-kms && \
rm -rf /tmp/sqlite_web && \
pip3 install peewee tzlocal pysqlite3 && \
chmod a+x /usr/bin/start.sh && \
apk del git
WORKDIR /home/py-kms
EXPOSE ${PORT}/tcp
ENTRYPOINT ["/usr/bin/start.sh"]

View File

@ -1,4 +1 @@
docker stop py3-kms
docker rm py3-kms
docker image rm pykms/pykms:py3-kms
docker build -t pykms/pykms:py3-kms .
docker build -t pykms/pykms:py3-kms . --file Dockerfile.amd64

View File

@ -0,0 +1,9 @@
#!/bin/bash
# Use manifest-tool to create the manifest, given the experimental
# "docker manifest" command isn't available yet on Docker Hub.
curl -Lo manifest-tool "https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64"
chmod +x manifest-tool
./manifest-tool push from-spec multi-arch-manifest-python3.yaml

View File

@ -0,0 +1,5 @@
#!/bin/bash
# Register qemu-*-static for all supported processors except the
# current one, but also remove all registered binfmt_misc before
docker run --rm --privileged multiarch/qemu-user-static:register --reset

View File

@ -0,0 +1,21 @@
image: pykmsorg/py-kms:python3
manifests:
- image: pykmsorg/py-kms:python3-amd64
platform:
architecture: amd64
os: linux
- image: pykmsorg/py-kms:python3-arm32v6
platform:
architecture: arm
os: linux
variant: v6
- image: pykmsorg/py-kms:python3-arm32v7
platform:
architecture: arm
os: linux
variant: v7
- image: pykmsorg/py-kms:python3-arm64v8
platform:
architecture: arm64
os: linux
variant: v8

View File

@ -17,14 +17,23 @@ command will download, "install" and start _py-kms_ and also keep it alive after
```bash
docker run -d --name py-kms --restart always -p 1688:1688 pykmsorg/py-kms
```
If you just want to use the image and don't want to build them yourself, you can always use the official image at the [Docker Hub](https://hub.docker.com/r/pykmsorg/py-kms) (`pykmsorg/py-kms`). To ensure that you are using always the
latest version you should check something like [watchtower](https://github.com/containrrr/watchtower) out !
#### Tags
There are currently three tags of the image available (select one just by appending `:<tag>` to the image from above):
* `latest`, currently the same like `minimal`.
* `minimal`, which is based on the python3 minimal configuration of py-kms. _This tag does NOT include `sqlite` support !_
* `python3`, which is fully configurable and equipped with `sqlite` support and a web interface for management.
If you just want to use the image and don't want to build them yourself, you can always use the official image at the [Docker Hub](https://hub.docker.com/r/pykmsorg/py-kms) (`pykmsorg/py-kms`). To ensure that you are using always the
latest version you should check something like [watchtower](https://github.com/containrrr/watchtower) out !
#### Architectures
There are currently the following architectures available (if you need an other, feel free to open an issue):
* `amd64`
* `arm32v6` Raspberry PI 1 (A, A+, B, B+, Zero)
* `arm32v7` Raspberry PI 2 (B)
* `arm64v8` Raspberry PI 2 (B v1.2), Raspberry PI 3 (A+, B, B+), Raspberry PI 4 (B)
_Please note that any architecture other than the classic `amd64` is slightly bigger (~4 MB), caused by the use of qemu during building._
### Systemd
If you are running a Linux distro using `systemd`, create the file: `sudo nano /etc/systemd/system/py3-kms.service`, then add the following (change it where needed) and save:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 346 KiB