-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (33 loc) · 1.22 KB
/
Dockerfile
File metadata and controls
45 lines (33 loc) · 1.22 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
FROM python:3.14-slim
ARG PG_MAJOR_VERSION=18
ENV TZ=Asia/Shanghai
ENV PYTHONUNBUFFERED=1
ENV PYTHONIOENCODING=utf-8
ENV PG_VERSION=${PG_MAJOR_VERSION}
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ca-certificates \
gnupg \
lsb-release \
tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /etc/apt/keyrings \
&& wget --quiet -O /etc/apt/keyrings/postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc \
&& echo "deb [signed-by=/etc/apt/keyrings/postgresql.asc] http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-client-${PG_MAJOR_VERSION} \
postgresql-client-common \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
RUN mkdir -p /backups
COPY Scripts/lib ./lib
COPY Scripts/main.py ./
RUN chmod +x main.py
RUN pg_dump --version && psql --version
ENTRYPOINT ["python3", "main.py", "backup"]