forked from github/backup-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
76 lines (65 loc) · 1.95 KB
/
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
# Multi stage build for backup-utils
# Build layer is for compiling rsync from source
# Runtime layer is for running backup-utils
# https://docs.docker.com/develop/develop-images/multistage-build/
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
# Build layer
FROM ubuntu:focal AS build
# Install build dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
gcc \
g++ \
gawk \
autoconf \
make \
automake \
python3-cmarkgfm \
acl \
libacl1-dev \
attr \
libattr1-dev \
libxxhash-dev \
libzstd-dev \
liblz4-dev \
libssl-dev \
git \
jq \
bc \
curl \
tar \
gzip \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Download rsync source from https://github.com/WayneD/rsync/archive/refs/tags/[TAG].tar.gz pinned to specified tag
ARG RSYNC_TAG=v3.2.7
RUN curl https://github.com/WayneD/rsync/archive/refs/tags/${RSYNC_TAG}.tar.gz -L -o ${RSYNC_TAG}.tar.gz
RUN mkdir -p /rsync-${RSYNC_TAG}&& tar -xzf ${RSYNC_TAG}.tar.gz -C /rsync-${RSYNC_TAG} --strip-components=1 && ls -la
# Change to the working directory of the rsync source
WORKDIR /rsync-${RSYNC_TAG}
RUN ls -la && ./configure
RUN make
RUN make install
# Reset working directory
WORKDIR /
# Runtime layer
FROM ubuntu:focal AS runtime
# Install runtime dependencies - bash, git, OpenSSH 5.6 or newer, and jq v1.5 or newer.
RUN apt-get update && apt-get install --no-install-recommends -y \
bash \
git \
openssh-client \
jq \
bc \
moreutils \
gawk \
ca-certificates \
xxhash \
&& rm -rf /var/lib/apt/lists/*
# Copy rsync from build layer
COPY --from=build /usr/local/bin/rsync /usr/local/bin/rsync
# Copy backup-utils from repository into /backup-utils
COPY ./ /backup-utils/
WORKDIR /backup-utils
RUN chmod +x /backup-utils/share/github-backup-utils/ghe-docker-init
ENTRYPOINT ["/backup-utils/share/github-backup-utils/ghe-docker-init"]
CMD ["ghe-host-check"]