-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile_make.alpine
96 lines (89 loc) · 3.42 KB
/
Dockerfile_make.alpine
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
FROM alpine:3.20
ARG BACKREST_VERSION
ARG BACKREST_DOWNLOAD_URL="https://github.com/pgbackrest/pgbackrest/archive/release"
ARG BACKREST_COMPLETION_VERSION
ARG BACKREST_COMPLETION_VERSION_URL="https://github.com/woblerr/pgbackrest-bash-completion/archive"
ARG REPO_BUILD_TAG
ENV TZ="Etc/UTC" \
BACKREST_USER="pgbackrest" \
BACKREST_UID=2001 \
BACKREST_GROUP="pgbackrest" \
BACKREST_GID=2001 \
BACKREST_HOST_TYPE="ssh" \
BACKREST_TLS_WAIT=15 \
BACKREST_TLS_SERVER="disable"
RUN apk add --no-cache --update \
bash \
shadow \
postgresql-client \
ca-certificates \
libxml2 \
libssh2 \
su-exec \
procps \
tzdata \
openssh \
libbz2 \
lz4-libs \
zstd-libs \
&& apk --update add --virtual .backrest-build \
build-base \
wget \
make \
gcc \
libpq-dev \
openssl-dev \
libxml2-dev \
pkgconfig \
lz4-dev \
zstd-dev \
bzip2-dev \
zlib-dev \
yaml-dev \
libssh2-dev \
&& ln -s /sbin/su-exec /usr/local/bin/gosu \
&& wget ${BACKREST_DOWNLOAD_URL}/${BACKREST_VERSION}.tar.gz -O /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz \
&& mkdir -p /tmp/pgbackrest-release \
&& tar -xzf /tmp/pgbackrest-${BACKREST_VERSION}.tar.gz --strip-components=1 -C /tmp/pgbackrest-release \
&& cd /tmp/pgbackrest-release/src \
&& ./configure \
&& make \
&& cp /tmp/pgbackrest-release/src/pgbackrest /usr/bin/pgbackrest \
&& groupadd --gid ${BACKREST_GID} ${BACKREST_GROUP} \
&& useradd --shell /bin/bash --uid ${BACKREST_UID} --gid ${BACKREST_GID} -m ${BACKREST_USER} \
&& wget ${BACKREST_COMPLETION_VERSION_URL}/${BACKREST_COMPLETION_VERSION}.tar.gz -O /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz \
&& tar -xzf /tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz -C /tmp \
&& mv /tmp/pgbackrest-bash-completion-$(echo ${BACKREST_COMPLETION_VERSION} | tr -d v) /tmp/pgbackrest-bash-completion \
&& mkdir -p -m 750 /var/log/pgbackrest \
/home/${BACKREST_USER}/.bash_completion.d \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/etc/pgbackrest/conf.d \
/etc/pgbackrest/cert \
/tmp/pgbackrest \
&& cp /tmp/pgbackrest-bash-completion/pgbackrest-completion.sh /home/${BACKREST_USER}/.bash_completion.d/pgbackrest-completion.sh \
&& touch /etc/pgbackrest/pgbackrest.conf \
&& chmod 640 /etc/pgbackrest/pgbackrest.conf \
&& chown -R ${BACKREST_USER}:${BACKREST_GROUP} \
/home/${BACKREST_USER}/.bash_completion.d \
/var/log/pgbackrest \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/tmp/pgbackrest \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone \
&& rm -rf \
/tmp/pgbackrest-release \
/tmp/pgbackrest-bash-completion \
/tmp/pgbackrest-${BACKREST_VERSION}.tar.gz \
/tmp/pgbackrest-bash-completion-${BACKREST_COMPLETION_VERSION}.tar.gz \
&& apk del .backrest-build \
&& rm -rf /var/cache/apk/*
COPY --chmod=755 files/entrypoint.sh /entrypoint.sh
LABEL \
org.opencontainers.image.version="${REPO_BUILD_TAG}" \
org.opencontainers.image.source="https://github.com/woblerr/docker-pgbackrest"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["pgbackrest", "version"]