forked from Synapse-bridgez/synapse-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
47 lines (36 loc) · 1.63 KB
/
Copy pathdockerfile
File metadata and controls
47 lines (36 loc) · 1.63 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
# Build stage
FROM rust:latest AS builder
WORKDIR /app
# Copy manifests and lockfile
COPY Cargo.toml Cargo.lock ./
# Copy workspace members required to resolve the workspace manifest
COPY sdks ./sdks
COPY cli ./cli
# Copy source and migrations
COPY src ./src
COPY migrations ./migrations
# Build the application
RUN cargo build --release
# Runtime stage
FROM debian:bookworm-slim
# postgresql-14 (client + server binaries) pulled from the PGDG repo, pinned
# to match the postgres:14-alpine image in docker-compose.yml: PITR restore
# (scripts/pitr_restore.sh) needs pg_basebackup/pg_ctl/postgres/psql on PATH,
# and physical-restore tooling should match the source server's major version.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates wget gnupg lsb-release \
&& install -d /usr/share/postgresql-common/pgdg \
&& wget -qO /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
https://www.postgresql.org/media/keys/ACCC4CF8.asc \
&& echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
> /etc/apt/sources.list.d/pgdg.list \
&& apt-get update && apt-get install -y --no-install-recommends postgresql-14 \
&& rm -rf /var/lib/apt/lists/*
ENV PATH="/usr/lib/postgresql/14/bin:${PATH}"
WORKDIR /app
COPY --from=builder /app/target/release/synapse-core /app/synapse-core
COPY --from=builder /app/migrations ./migrations
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1
CMD ["/app/synapse-core"]