Archived
Use best practices for Dockerfiles (#180)
This commit is contained in:
1 parent
bcbe60a8d8
commit
5cc50eb522
7 files changed
+34
-25
No files matched your search
+18
-7
@@ -1,18 +1,29 @@
|
||||
FROM postgres:9.4
|
||||
|
||||
# Install some packages to use WAL
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y python-dev libffi-dev libssl-dev lzop pv daemontools curl build-essential \
|
||||
&& apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
daemontools \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
lzop \
|
||||
pv \
|
||||
python-dev \
|
||||
&& curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python \
|
||||
&& pip install 'wal-e<1.0.0' \
|
||||
&& apt-get remove -y build-essential python-dev \
|
||||
&& apt-get remove -y \
|
||||
build-essential \
|
||||
python-dev \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin /tmp/* /var/tmp/*
|
||||
|
||||
# Add wale script
|
||||
COPY setup-wale.sh /docker-entrypoint-initdb.d/
|
||||
COPY docker-entrypoint1.sh /
|
||||
RUN chmod +x /docker-entrypoint1.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint1.sh"]
|
||||
|
||||
# Add and configure entrypoint and command
|
||||
COPY entrypoint.sh /
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["postgres"]
|
||||
@@ -30,6 +30,7 @@ if [ "$1" = 'postgres' ]; then
|
||||
if [ "${!v}" = "" ]; then
|
||||
echo "$v is required for Wal-E but not set. Skipping Wal-E setup."
|
||||
update_conf
|
||||
# Run the postgresql entrypoint
|
||||
. /docker-entrypoint.sh
|
||||
exit
|
||||
fi
|
||||
@@ -47,5 +48,6 @@ if [ "$1" = 'postgres' ]; then
|
||||
ARCHIVE_MODE=on
|
||||
|
||||
update_conf
|
||||
# Run the postgresql entrypoint
|
||||
. /docker-entrypoint.sh
|
||||
fi
|
||||
@@ -5,7 +5,3 @@ echo "wal_level = $WAL_LEVEL" >> $PGDATA/postgresql.conf
|
||||
echo "archive_mode = $ARCHIVE_MODE" >> $PGDATA/postgresql.conf
|
||||
echo "archive_command = 'envdir /etc/wal-e.d/env /usr/local/bin/wal-e wal-push %p'" >> $PGDATA/postgresql.conf
|
||||
echo "archive_timeout = $ARCHIVE_TIMEOUT" >> $PGDATA/postgresql.conf
|
||||
|
||||
# no cron in the image, use systemd timer on host instead
|
||||
#su - postgres -c "crontab -l | { cat; echo \"0 3 * * * /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/data\"; } | crontab -"
|
||||
#su - postgres -c "crontab -l | { cat; echo \"0 4 * * * /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e delete --confirm retain 7\"; } | crontab -"
|
||||
Reference in new issue
Block a user