commit
fcbdd3164a
@ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- devel
|
||||
- main
|
||||
paths:
|
||||
- "Dockerfile"
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
FROM alpine:latest
|
||||
|
||||
LABEL maintainer="development@cooltux.net"
|
||||
ARG VERSION=16-20240926.1
|
||||
ARG VERSION=16-20240926
|
||||
|
||||
# PostgreSQL-Client installieren
|
||||
RUN apk update --no-cache ; \
|
||||
apk add --no-cache postgresql16-client
|
||||
|
||||
# Erstelle einen Benutzer mit UID 26
|
||||
RUN adduser -u 1000 -D -S backupuser
|
||||
|
||||
# Arbeitsverzeichnis erstellen
|
||||
WORKDIR /backup
|
||||
|
||||
@ -16,5 +19,8 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
# Skript ausführbar machen
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Wechsle den Benutzer auf den erstellten Benutzer mit UID 26
|
||||
USER 1000
|
||||
|
||||
# Festlegen des EntryPoints für das Docker-Image
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
@ -13,7 +13,7 @@ echo "$PGHOST:5432:$PGDATABASE:$PGUSER:$PGPASSWORD" > ~/.pgpass
|
||||
chmod 600 ~/.pgpass
|
||||
|
||||
# Optional: Standardwert für den Dateinamen der Sicherung
|
||||
BACKUP_FILE=${BACKUP_FILE:-"/backup/$PGDATABASE_$(date +%Y%m%d_%H%M%S).sql"}
|
||||
BACKUP_FILE=${BACKUP_FILE:-"/backup/$(echo $PGDATABASE)DB_$(date +%d-%m-%Y).sql"}
|
||||
|
||||
# Führe den pg_dump-Befehl aus (pg_dump wird automatisch die .pgpass-Datei verwenden)
|
||||
pg_dump -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -F c -f "$BACKUP_FILE"
|
||||
|
Loading…
Reference in New Issue
Block a user