-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharch.dockerfile
56 lines (46 loc) · 1.24 KB
/
arch.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
# :: Util
FROM 11notes/util AS util
# :: 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}
# :: multi-stage
COPY --from=util /usr/local/bin/ /usr/local/bin
# :: Run
USER root
RUN eleven printenv;
# :: install application
RUN set -ex; \
apk --update --no-cache add \
dcron=~${APP_VERSION}; \
apk --update --no-cache --virtual .build add \
libcap-setcap; \
mkdir -p ${APP_ROOT}/etc; \
rm -rf /etc/cron.d/*; \
rm -rf /etc/crontabs; \
ln -sf ${APP_ROOT}/etc /etc/crontabs;
# :: copy filesystem changes and set correct permissions
COPY ./rootfs /
RUN set -ex; \
chmod +x -R /usr/local/bin; \
chown -R 1000:1000 \
/usr/sbin/crond \
/var/spool/cron/crontabs \
${APP_ROOT};
# :: set special caps
RUN set -ex; \
setcap cap_setgid=ep /usr/sbin/crond; \
apk del --no-network .build;
# :: Monitor
HEALTHCHECK --interval=5s --timeout=2s CMD netstat -an | grep -q 1688 || exit 1
# :: Start
USER docker