-
-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (48 loc) · 2.16 KB
/
Dockerfile
File metadata and controls
64 lines (48 loc) · 2.16 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
# syntax=docker/dockerfile:1.3-labs
FROM debian:trixie-slim AS base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl tini ca-certificates postgresql-client && \
rm -rf /var/lib/apt/lists/*
# We use bookworm since the icu dependency ver. between the base and golang images is the same
FROM golang:1.25-trixie AS build-from-source
ENV DEBIAN_FRONTEND=noninteractive
ARG DOLTGRES_VERSION="latest"
RUN mkdir -p /tmp/doltgresql/
COPY . /tmp/doltgresql/
WORKDIR /tmp/doltgresql/
RUN if [ "$DOLTGRES_VERSION" = "source" ]; then \
go mod download; \
./postgres/parser/build.sh; \
./scripts/build_binaries.sh "linux-amd64"; \
mv out/doltgresql-*/bin/doltgres /usr/local/bin; \
fi
FROM base AS download-binary
ARG DOLTGRES_VERSION="latest"
RUN if [ "$DOLTGRES_VERSION" = "latest" ]; then \
version=$(curl -s "https://api.github.com/repos/dolthub/doltgresql/releases/latest" \
| grep '"tag_name"' \
| cut -d'"' -f4 \
| sed 's/^v//'); \
echo "fetching https://github.com/dolthub/doltgresql/releases/download/v${version}/install.sh"; \
curl -L "https://github.com/dolthub/doltgresql/releases/download/v${version}/install.sh" | bash; \
fi
RUN if [ "$DOLTGRES_VERSION" != "latest" ] && [ "$DOLTGRES_VERSION" != "source" ]; then \
echo "fetching https://github.com/dolthub/doltgresql/releases/download/v${DOLTGRES_VERSION}/install.sh"; \
curl -L "https://github.com/dolthub/doltgresql/releases/download/v${DOLTGRES_VERSION}/install.sh" | bash; \
fi
FROM base AS runtime
# Only one binary is possible due to DOLTGRES_VERSION, so we optionally copy from either stage
COPY --from=download-binary /usr/local/bin/doltgres* /usr/local/bin/
COPY --from=build-from-source /usr/local/bin/doltgres* /usr/local/bin/
RUN /usr/local/bin/doltgres --version
RUN mkdir /docker-entrypoint-initdb.d && \
mkdir -p /var/lib/doltgres && \
chmod 755 /var/lib/doltgres
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
VOLUME /var/lib/doltgres
EXPOSE 5432
WORKDIR /var/lib/doltgres
ENTRYPOINT ["tini", "-v", "--", "docker-entrypoint.sh"]