Skip to content

Commit

Permalink
Revert remove env variables from Dockerfile
Browse files Browse the repository at this point in the history
This reverts commit 84a26ce.
  • Loading branch information
prodrigestivill committed Aug 20, 2022
1 parent 84a26ce commit 1f46aba
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 24 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ jobs:
POSTGRES_PORT: 5432
POSTGRES_EXTRA_OPTS: "-Z0"
BACKUP_DIR: ".data"
# Defaults
POSTGRES_DB_FILE: "**None**"
POSTGRES_USER_FILE: "**None**"
POSTGRES_PASSWORD_FILE: "**None**"
POSTGRES_PASSFILE_STORE: "**None**"
POSTGRES_CLUSTER: "FALSE"
BACKUP_SUFFIX: ".sql.gz"
BACKUP_KEEP_DAYS: 7
BACKUP_KEEP_WEEKS: 4
BACKUP_KEEP_MONTHS: 6
BACKUP_KEEP_MINS: 1440
WEBHOOK_URL: "**None**"
WEBHOOK_EXTRA_ARGS: ""
run: |
echo "Test backup script for pg_dump..."
rm -fR "$BACKUP_DIR"
Expand All @@ -51,6 +64,18 @@ jobs:
POSTGRES_EXTRA_OPTS: "-Z0 -Fd"
BACKUP_SUFFIX: ""
BACKUP_DIR: ".data"
# Defaults
POSTGRES_DB_FILE: "**None**"
POSTGRES_USER_FILE: "**None**"
POSTGRES_PASSWORD_FILE: "**None**"
POSTGRES_PASSFILE_STORE: "**None**"
POSTGRES_CLUSTER: "FALSE"
BACKUP_KEEP_DAYS: 7
BACKUP_KEEP_WEEKS: 4
BACKUP_KEEP_MONTHS: 6
BACKUP_KEEP_MINS: 1440
WEBHOOK_URL: "**None**"
WEBHOOK_EXTRA_ARGS: ""
run: |
echo "Test backup script for pg_dump with directories..."
rm -fR "$BACKUP_DIR"
Expand All @@ -68,6 +93,18 @@ jobs:
POSTGRES_PORT: 5432
POSTGRES_EXTRA_OPTS: ""
BACKUP_DIR: ".data"
# Defaults
POSTGRES_DB_FILE: "**None**"
POSTGRES_USER_FILE: "**None**"
POSTGRES_PASSWORD_FILE: "**None**"
POSTGRES_PASSFILE_STORE: "**None**"
BACKUP_SUFFIX: ".sql.gz"
BACKUP_KEEP_DAYS: 7
BACKUP_KEEP_WEEKS: 4
BACKUP_KEEP_MONTHS: 6
BACKUP_KEEP_MINS: 1440
WEBHOOK_URL: "**None**"
WEBHOOK_EXTRA_ARGS: ""
run: |
echo "Test backup script for pg_dumpall..."
rm -fR "$BACKUP_DIR"
Expand Down
22 changes: 21 additions & 1 deletion alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,27 @@ RUN set -x \
&& curl -L https://github.com/prodrigestivill/go-cron/releases/download/$GOCRONVER/go-cron-$TARGETOS-$TARGETARCH-static.gz | zcat > /usr/local/bin/go-cron \
&& chmod a+x /usr/local/bin/go-cron

ENV SCHEDULE="@daily" HEALTHCHECK_PORT=8080
ENV POSTGRES_DB="**None**" \
POSTGRES_DB_FILE="**None**" \
POSTGRES_HOST="**None**" \
POSTGRES_PORT=5432 \
POSTGRES_USER="**None**" \
POSTGRES_USER_FILE="**None**" \
POSTGRES_PASSWORD="**None**" \
POSTGRES_PASSWORD_FILE="**None**" \
POSTGRES_PASSFILE_STORE="**None**" \
POSTGRES_EXTRA_OPTS="-Z6" \
POSTGRES_CLUSTER="FALSE" \
SCHEDULE="@daily" \
BACKUP_DIR="/backups" \
BACKUP_SUFFIX=".sql.gz" \
BACKUP_KEEP_DAYS=7 \
BACKUP_KEEP_WEEKS=4 \
BACKUP_KEEP_MONTHS=6 \
BACKUP_KEEP_MINS=1440 \
HEALTHCHECK_PORT=8080 \
WEBHOOK_URL="**None**" \
WEBHOOK_EXTRA_ARGS=""

COPY backup.sh /backup.sh

Expand Down
22 changes: 0 additions & 22 deletions backup.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
#!/usr/bin/env bash
set -Eeo pipefail

# Set the default env values if empty
POSTGRES_DB=${POSTGRES_DB:-"**None**"}
POSTGRES_DB_FILE=${POSTGRES_DB_FILE:-"**None**"}
POSTGRES_HOST=${POSTGRES_HOST:-"**None**"}
POSTGRES_PORT=${POSTGRES_PORT:-5432}
POSTGRES_USER=${POSTGRES_USER:-"**None**"}
POSTGRES_USER_FILE=${POSTGRES_USER_FILE:-"**None**"}
POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-"**None**"}
POSTGRES_PASSWORD_FILE=${POSTGRES_PASSWORD_FILE:-"**None**"}
POSTGRES_PASSFILE_STORE=${POSTGRES_PASSFILE_STORE:-"**None**"}
POSTGRES_EXTRA_OPTS=${POSTGRES_EXTRA_OPTS:-"-Z6"}
POSTGRES_CLUSTER=${POSTGRES_CLUSTER:-"FALSE"}
BACKUP_DIR=${BACKUP_DIR:-"/backups"}
BACKUP_SUFFIX=${BACKUP_SUFFIX:-".sql.gz"}
BACKUP_KEEP_DAYS=${BACKUP_KEEP_DAYS:-7}
BACKUP_KEEP_WEEKS=${BACKUP_KEEP_WEEKS:-4}
BACKUP_KEEP_MONTHS=${BACKUP_KEEP_MONTHS:-6}
BACKUP_KEEP_MINS=${BACKUP_KEEP_MINS:-1440}
WEBHOOK_URL=${WEBHOOK_URL:-"**None**"}
WEBHOOK_EXTRA_ARGS=${WEBHOOK_EXTRA_ARGS:-""}

# Script start
if [ "${POSTGRES_DB}" = "**None**" -a "${POSTGRES_DB_FILE}" = "**None**" ]; then
echo "You need to set the POSTGRES_DB or POSTGRES_DB_FILE environment variable."
exit 1
Expand Down
22 changes: 21 additions & 1 deletion debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,27 @@ RUN set -x \
&& gzip -vnd /usr/local/bin/go-cron.gz && chmod a+x /usr/local/bin/go-cron \
&& apt-get purge -y --auto-remove ca-certificates && apt-get clean

ENV SCHEDULE="@daily" HEALTHCHECK_PORT=8080
ENV POSTGRES_DB="**None**" \
POSTGRES_DB_FILE="**None**" \
POSTGRES_HOST="**None**" \
POSTGRES_PORT=5432 \
POSTGRES_USER="**None**" \
POSTGRES_USER_FILE="**None**" \
POSTGRES_PASSWORD="**None**" \
POSTGRES_PASSWORD_FILE="**None**" \
POSTGRES_PASSFILE_STORE="**None**" \
POSTGRES_EXTRA_OPTS="-Z6" \
POSTGRES_CLUSTER="FALSE" \
SCHEDULE="@daily" \
BACKUP_DIR="/backups" \
BACKUP_SUFFIX=".sql.gz" \
BACKUP_KEEP_DAYS=7 \
BACKUP_KEEP_WEEKS=4 \
BACKUP_KEEP_MONTHS=6 \
BACKUP_KEEP_MINS=1440 \
HEALTHCHECK_PORT=8080 \
WEBHOOK_URL="**None**" \
WEBHOOK_EXTRA_ARGS=""

COPY backup.sh /backup.sh

Expand Down

0 comments on commit 1f46aba

Please sign in to comment.