-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathDockerfile
44 lines (35 loc) · 911 Bytes
/
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
ARG POSTGRES_VERSION=12.16
FROM postgres:${POSTGRES_VERSION}-bullseye
LABEL org.opencontainers.image.authors="[email protected]"
RUN \
apt-get update && \
apt-get install -y cron && \
apt-get install -y s3cmd && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
EXPOSE 5432
ENV PGDATA="/data"
ENV PGDUMP="/dump"
ENV PGUSER=postgres
# S3 defaults
ENV S3_HOSTNAME="s3.amazonaws.com"
ENV S3_HOST_BUCKET="%(bucket)s.s3.amazonaws.com"
ENV S3_SSL_OPTION="--ssl"
COPY --chown=${PGUSER}:${PGUSER} \
[ "dump.sh", \
"entrypoint.sh", \
"/" ]
USER root
RUN \
chmod 755 dump.sh && \
chmod 755 entrypoint.sh && \
chmod gu+rw /var/run && \
chmod gu+s /usr/sbin/cron && \
mkdir ${PGDUMP} && \
chown ${PGUSER}:${PGUSER} ${PGDUMP} && \
mkdir ${PGDATA} && \
chown ${PGUSER}:${PGUSER} ${PGDATA}
VOLUME [ "${PGDUMP}", "${PGDATA}" ]
USER ${PGUSER}
ENTRYPOINT ["bash", "/entrypoint.sh"]
CMD ["dump-cron"]