-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile_make
98 lines (85 loc) · 3.37 KB
/
Dockerfile_make
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
FROM ubuntu:22.04 AS builder
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"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
make \
gcc \
libpq-dev \
libssl-dev \
libxml2-dev \
pkg-config \
liblz4-dev \
libzstd-dev \
libbz2-dev \
libz-dev \
libyaml-dev \
libssh2-1-dev \
wget \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN 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
RUN 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
FROM ubuntu:22.04
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 apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
postgresql-client \
ca-certificates \
tzdata \
libxml2 \
libssh2-1 \
gosu \
openssh-client \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --gid ${BACKREST_GID} ${BACKREST_GROUP} \
&& useradd --shell /bin/bash --uid ${BACKREST_UID} --gid ${BACKREST_GID} -m ${BACKREST_USER} \
&& mkdir -p -m 750 \
/home/${BACKREST_USER}/.bash_completion.d \
/var/log/pgbackrest \
/var/lib/pgbackrest \
/var/spool/pgbackrest \
/etc/pgbackrest \
/etc/pgbackrest/conf.d \
/etc/pgbackrest/cert \
/tmp/pgbackrest \
&& 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 \
&& unlink /etc/localtime \
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone
COPY --chmod=755 files/entrypoint.sh /entrypoint.sh
COPY --from=builder --chown=${BACKREST_USER}:${BACKREST_GROUP} /tmp/pgbackrest-bash-completion/pgbackrest-completion.sh /home/${BACKREST_USER}/.bash_completion.d/pgbackrest-completion.sh
COPY --from=builder /tmp/pgbackrest-release/src/pgbackrest /usr/bin/pgbackrest
LABEL \
org.opencontainers.image.version="${REPO_BUILD_TAG}" \
org.opencontainers.image.source="https://github.com/woblerr/docker-pgbackrest"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["pgbackrest", "version"]