-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
78 lines (61 loc) · 1.69 KB
/
Dockerfile
File metadata and controls
78 lines (61 loc) · 1.69 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM oven/bun:1-alpine AS build
WORKDIR /app
# Copy package files
COPY package.json tsconfig.json ./
COPY src ./src
# Install dependencies and build
RUN bun install --frozen-lockfile && \
bun build src/index.ts --compile --outfile postgres-backup
# Final stage
FROM alpine:latest
LABEL maintainer="johnnybui"
LABEL description="Postgres backup to S3/R2/S3-compatible storage with multiple database support"
# Install runtime dependencies
RUN apk update && \
apk upgrade && \
apk add --no-cache \
bash \
coreutils \
postgresql17-client \
aws-cli \
openssl \
pigz \
ca-certificates \
curl && \
rm -rf /var/cache/apk/*
# Copy compiled binary from build stage
COPY --from=build /app/postgres-backup /usr/local/bin/postgres-backup
# Copy shell scripts
COPY backup.sh /backup.sh
COPY restore.sh /restore.sh
COPY run.sh /run.sh
RUN chmod +x /backup.sh /restore.sh /run.sh /usr/local/bin/postgres-backup
# Environment variables with defaults
ENV POSTGRES_DATABASE=**None**
ENV POSTGRES_HOST=**None**
ENV POSTGRES_PORT=5432
ENV POSTGRES_USER=**None**
ENV POSTGRES_PASSWORD=**None**
ENV POSTGRES_EXTRA_OPTS=''
ENV STORAGE_TYPE=S3
ENV S3_ACCESS_KEY_ID=**None**
ENV S3_SECRET_ACCESS_KEY=**None**
ENV S3_BUCKET=**None**
ENV S3_REGION=us-west-1
ENV S3_PREFIX=backup
ENV S3_ENDPOINT=**None**
ENV S3_S3V4=no
ENV R2_ACCOUNT_ID=**None**
ENV SCHEDULE=**None**
ENV PARALLEL_BACKUP=no
ENV ENCRYPTION_PASSWORD=**None**
ENV DELETE_OLDER_THAN=**None**
ENV BACKUP_FILE=**None**
ENV CREATE_DATABASE=no
ENV DROP_DATABASE=no
ENV USE_CUSTOM_FORMAT=no
ENV COMPRESSION_CMD=gzip
ENV DECOMPRESSION_CMD='gunzip -c'
ENV PARALLEL_JOBS=1
WORKDIR /
CMD ["sh", "/run.sh"]