Skip to content

Commit 99bc7e8

Browse files
authored
Merge pull request #26 from cybertec-postgresql/reduceContainerSize
fix missing files for pg
2 parents 6a1b34f + 2a02ca7 commit 99bc7e8

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ base-build:
4646
base: base-build;
4747

4848
pgbackrest-build:
49-
docker build $(ROOTPATH) --no-cache \
49+
docker build $(ROOTPATH) \
5050
--file $(ROOTPATH)/docker/pgbackrest/Dockerfile \
5151
--tag cybertec-pg-container/pgbackrest:$(IMAGE_TAG)-$(BUILD) \
5252
--build-arg BASE_IMAGE=$(BASE_IMAGE) \

docker/pgbackrest/Dockerfile

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ RUN rm -rf /var/spool/pgbackrest
3939
# Add kubectl
4040
RUN curl -LO https://dl.k8s.io/release/v1.30.0/bin/linux/amd64/kubectl && chmod +x kubectl
4141

42+
RUN mkdir -p /tmp/pgsql && cp -r /usr/pgsql* /tmp/pgsql
43+
RUN mkdir -p /tmp/pg && cp -r /usr/bin/pg* /tmp/pg
44+
RUN mkdir -p /tmp/lz4 && cp -r /usr/bin/lz4* /tmp/lz4
45+
RUN mkdir -p /tmp/zstd && cp -r /usr/bin/zstd* /tmp/zstd
46+
47+
4248
FROM ${CONTAINERIMAGE} as micro
4349

4450
ARG PGVERSION
@@ -57,27 +63,37 @@ COPY --from=builder /usr/share/licenses/pgbackrest/LICENSE /usr/share/licenses/p
5763
COPY --from=builder /var/lib/pgbackrest /var/lib/pgbackrest
5864
COPY --from=builder /var/log/pgbackrest /var/log/pgbackrest
5965
# Postgres
66+
COPY --from=builder /tmp/pgsql/ /usr/
6067
COPY --from=builder /var/lib/pgsql /var/lib/pgsql
68+
COPY --from=builder /tmp/pg /usr/bin/
69+
6170
COPY --from=builder ./kubectl /usr/local/bin/
6271
# lz4
63-
COPY --from=builder /usr/bin/lz4* /usr/bin/lz4*
72+
COPY --from=builder /tmp/lz4 /usr/bin/
6473
# zstd
65-
COPY --from=builder /usr/bin/zstd* /usr/bin/zstd*
74+
COPY --from=builder /tmp/zstd /usr/bin/
6675
# Others
6776
COPY --from=builder /usr/bin/sed /usr/bin/sed
6877
COPY --from=builder /usr/bin/jq /usr/bin/jq
6978
COPY --from=builder /usr/bin/watch /usr/bin/watch
7079
COPY --from=builder /usr/share/locale /usr/share/locale
7180
COPY --from=builder /usr/lib /usr/lib
7281
COPY --from=builder /usr/lib64 /usr/lib64
73-
# PostgreSQL
74-
# TODO: implement a method that works with $PG_SUPPORTED_VERSIONS
75-
COPY --from=builder /usr/pgsql-13 /usr/pgsql-13
76-
COPY --from=builder /usr/pgsql-14 /usr/pgsql-14
77-
COPY --from=builder /usr/pgsql-15 /usr/pgsql-15
78-
COPY --from=builder /usr/pgsql-16 /usr/pgsql-16
79-
COPY --from=builder /var/lib/pgsql /var/lib/pgsql
80-
COPY --from=builder /usr/bin/pg_* /usr/bin/
82+
# CA
83+
COPY --from=builder /usr/bin/ca-legacy /usr/bin/ca-legacy
84+
COPY --from=builder /usr/bin/update-ca-trust /usr/bin/update-ca-trust
85+
# p11-kit
86+
COPY --from=builder /etc/pkcs11 /etc/pkcs11
87+
COPY --from=builder /usr/libexec/p11-kit /usr/libexec/p11-kit
88+
COPY --from=builder /usr/share/bash-completion/completions /usr/share/bash-completion/completions
89+
COPY --from=builder /usr/share/p11-kit /usr/share/p11-kit
90+
COPY --from=builder /usr/share/polkit-1 /usr/share/polkit-1
91+
92+
COPY --from=builder /usr/bin/p11-kit /usr/bin/p11-kit
93+
COPY --from=builder /etc/pki /etc/pki
94+
COPY --from=builder /usr/share/pki /usr/share/pki
95+
COPY --from=builder /etc/ssl /etc/ssl
96+
COPY --from=builder /etc/pkcs11 /etc/pkcs11
8197

8298
# libraries
8399
COPY --from=builder /usr/bin/nss_wrapper.pl /usr/bin/nss_wrapper.pl
@@ -100,6 +116,8 @@ ADD /scripts/nss_wrapper /scripts/nss_wrapper
100116
FROM scratch
101117
COPY --from=micro / /
102118

119+
ARG PGVERSION
120+
103121
# set user and group ownership
104122
RUN chown -R postgres:postgres /opt/pgbackrest \
105123
/backrestrepo /home/postgres/pgdata/pgbackrest /home/postgres/pgdata

0 commit comments

Comments
 (0)