forked from 11notes/docker-kms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharch.dockerfile
More file actions
96 lines (79 loc) · 2.12 KB
/
Copy patharch.dockerfile
File metadata and controls
96 lines (79 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# :: 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=26
ENV KMS_ACTIVATIONINTERVAL=120
ENV KMS_RENEWALINTERVAL=10080
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=3.12.8-r1; \
apk --no-cache --update --virtual .build add \
py3-pip;
RUN set -ex; \
mkdir -p ${APP_ROOT}/var; \
touch /var/log/kms.log; \
ln -sf /dev/stdout /var/log/kms.log; \
cd /usr/local/bin; \
pip3 install --no-cache-dir tzlocal --break-system-packages; \
apk del --no-network .build;
# :: 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