-
-
Notifications
You must be signed in to change notification settings - Fork 209
Expand file tree
/
Copy pathDockerfile.dockerhub
More file actions
64 lines (52 loc) · 1.6 KB
/
Dockerfile.dockerhub
File metadata and controls
64 lines (52 loc) · 1.6 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
# Stage 1: Build
FROM python:3.12.12-slim AS build
WORKDIR /app
# Install system dependencies and ensure system libraries are updated (e.g., glibc)
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y gcc libpq-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy PGSync source code
COPY \
pgsync/__init__.py \
pgsync/base.py \
pgsync/constants.py \
pgsync/exc.py \
pgsync/helper.py \
pgsync/node.py \
pgsync/plugin.py \
pgsync/querybuilder.py \
pgsync/redisqueue.py \
pgsync/search_client.py \
pgsync/settings.py \
pgsync/singleton.py \
pgsync/sync.py \
pgsync/transform.py \
pgsync/trigger.py \
pgsync/urls.py \
pgsync/utils.py \
pgsync/view.py /app/pgsync/
COPY requirements/base.txt /app/requirements/
COPY README.rst README.md LICENSE setup.cfg setup.py /app/
COPY bin/bootstrap bin/parallel_sync bin/pgsync /app/bin/
COPY \
scripts/pg_replication_slots.sh \
scripts/pg_locks.sh \
scripts/pg_temp_tables.sh \
/app/scripts/
# Install PGSync and dependencies
RUN pip install --no-cache-dir .
# Stage 2: Runtime
FROM python:3.12.12-slim AS runtime
RUN apt-get update && apt-get upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create non-root user
RUN useradd --no-create-home --shell /bin/false pgsync
USER pgsync
COPY --from=build /usr/local/lib/python3.12 /usr/local/lib/python3.12
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /app /app
# Add binaries to PATH
ENV PATH="/usr/local/bin:${PATH}"
# Entrypoint matches pgsync CLI behavior
ENTRYPOINT ["pgsync"]