diff --git a/Dockerfile b/Dockerfile index 2c5a7a9..d0d6296 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,12 +8,12 @@ RUN apk update \ COPY main.go /app/main.go -RUN go mod init github.com/itbm/postgresql-backup-s3 \ +RUN go mod init github.com/guy1998/postgresql-backup-s3 \ && go get github.com/robfig/cron/v3 \ && go build -o out/go-cron FROM alpine:3.22 -LABEL maintainer="ITBM" +LABEL maintainer="guy1998" RUN apk update \ && apk upgrade \ @@ -45,6 +45,7 @@ ENV USE_CUSTOM_FORMAT no ENV COMPRESSION_CMD 'gzip' ENV DECOMPRESSION_CMD 'gunzip -c' ENV PARALLEL_JOBS 1 +ENV TABLES **None** ADD run.sh run.sh ADD backup.sh backup.sh diff --git a/backup.sh b/backup.sh index 8fd1932..e9793f4 100644 --- a/backup.sh +++ b/backup.sh @@ -66,6 +66,9 @@ if [ "$USE_CUSTOM_FORMAT" = "yes" ]; then if [ "${POSTGRES_DATABASE}" == "all" ]; then echo "ERROR: Custom format (-Fc) is not supported with pg_dumpall." exit 1 + elif [ -n "$TABLES" ]; then + echo "Dumping specific tables in custom format: $TABLES" + pg_dump -Fc $POSTGRES_HOST_OPTS -d "$POSTGRES_DATABASE" $(for table in $TABLES; do echo -n "-t $table "; done) > "$SRC_FILE" else pg_dump -Fc $POSTGRES_HOST_OPTS $POSTGRES_DATABASE > $SRC_FILE fi