-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrsync.dockerfile
More file actions
92 lines (78 loc) · 2.81 KB
/
Copy pathrsync.dockerfile
File metadata and controls
92 lines (78 loc) · 2.81 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
# ╔═════════════════════════════════════════════════════╗
# ║ SETUP ║
# ╚═════════════════════════════════════════════════════╝
# GLOBAL
ARG APP_UID=1000 \
APP_GID=1000
# :: FOREIGN IMAGES
FROM 11notes/util:bin AS util-bin
# ╔═════════════════════════════════════════════════════╗
# ║ BUILD ║
# ╚═════════════════════════════════════════════════════╝
# :: RSYNC
FROM alpine AS build
COPY --from=util-bin / /
ARG TARGETARCH \
TARGETVARIANT \
APP_VERSION \
BUILD_SRC=https://github.com/RsyncProject/rsync.git \
BUILD_ROOT=/rsync \
BUILD_BIN=/rsync/rsync
RUN set -ex; \
apk --update --no-cache add \
build-base \
git \
popt-dev \
zlib-dev \
openssl-dev \
xxhash-dev \
lz4-dev \
zstd-dev \
automake \
autoconf \
gettext-dev;
RUN set -ex; \
eleven git clone ${BUILD_SRC} v${APP_VERSION};
RUN set -ex; \
cd ${BUILD_ROOT}; \
./configure \
--disable-openssl \
--disable-xxhash \
--disable-lz4 \
--disable-zstd \
--disable-md2man \
CFLAGS="-O2 -static" \
LDFLAGS="-static"; \
make -s -j $(nproc) 2>&1 > /dev/null;
RUN set -ex; \
eleven distroless ${BUILD_BIN};
RUN set -ex; \
/distroless/usr/local/bin/rsync --version | grep -q "${APP_VERSION}";
# ╔═════════════════════════════════════════════════════╗
# ║ IMAGE ║
# ╚═════════════════════════════════════════════════════╝
# :: HEADER
FROM scratch
# :: default arguments
ARG TARGETPLATFORM \
TARGETOS \
TARGETARCH \
TARGETVARIANT \
APP_IMAGE \
APP_NAME \
APP_VERSION \
APP_ROOT \
APP_UID \
APP_GID \
APP_NO_CACHE
# :: default environment
ENV APP_IMAGE=${APP_IMAGE} \
APP_NAME=${APP_NAME} \
APP_VERSION=${APP_VERSION} \
APP_ROOT=${APP_ROOT}
# :: multi-stage
COPY --from=build ${APP_ROOT}/ /
# :: EXECUTE
USER ${APP_UID}:${APP_GID}
ENTRYPOINT ["/usr/local/bin/rsync"]
CMD ["--version"]