-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patharm64v8.dockerfile
100 lines (87 loc) · 2.29 KB
/
arm64v8.dockerfile
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
97
98
99
100
# :: 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"]