aboutsummaryrefslogtreecommitdiff
path: root/app/postgres/build
diff options
context:
space:
mode:
Diffstat (limited to 'app/postgres/build')
-rw-r--r--app/postgres/build/postgres/Dockerfile31
-rwxr-xr-xapp/postgres/build/postgres/start.sh22
2 files changed, 11 insertions, 42 deletions
diff --git a/app/postgres/build/postgres/Dockerfile b/app/postgres/build/postgres/Dockerfile
index 23243aa..5217bc5 100644
--- a/app/postgres/build/postgres/Dockerfile
+++ b/app/postgres/build/postgres/Dockerfile
@@ -1,25 +1,16 @@
-FROM amd64/debian:stretch
+FROM golang:1.13-buster AS builder
ARG STOLON_VERSION
-ARG PG_VERSION
-
-RUN echo "deb http://deb.debian.org/debian stretch-backports main contrib non-free # available after stretch release" > /etc/apt/sources.list.d/stretch-backports.list && \
- apt-get update && \
- apt-get -qq -y full-upgrade && \
- apt-get install -y \
- postgresql-all=${PG_VERSION} \
- golang-1.11 \
- git && \
- export GOPATH=/usr/local/go && \
- mkdir -p /usr/local/go/src/github.com/sorintlab && \
- cd /usr/local/go/src/github.com/sorintlab && \
- git clone --depth 1 --branch ${STOLON_VERSION} https://github.com/sorintlab/stolon && \
- ln -s /usr/lib/go-1.11/bin/go /usr/bin/go && \
- ln -s /usr/lib/go-1.11/bin/gofmt /usr/bin/gofmt && \
- cd ./stolon && \
- ./build && \
- mv /usr/local/go/src/github.com/sorintlab/stolon/bin/* /usr/local/bin/ && \
- rm -rf /usr/local/go
+WORKDIR /stolon
+RUN git clone https://github.com/sorintlab/stolon .
+RUN git pull && git checkout ${STOLON_VERSION}
+RUN go mod download
+RUN make && chmod +x /stolon/bin/*
+FROM amd64/debian:stretch
+ARG PG_VERSION
+RUN apt-get update && \
+ apt-get install -y postgresql-all=${PG_VERSION}
+COPY --from=builder /stolon/bin /usr/local/bin
USER postgres
diff --git a/app/postgres/build/postgres/start.sh b/app/postgres/build/postgres/start.sh
deleted file mode 100755
index f1d493f..0000000
--- a/app/postgres/build/postgres/start.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-if [ -f /local/pg_hba.conf ]; then
- echo "Copying Nomad configuration..."
- cp /local/pg_hba.conf /etc/postgresql/9.6/main/
- echo "Done"
-fi
-
-
-if [ -z "$(ls -A /var/lib/postgresql/9.6/main)" ]; then
- echo "Copying base"
- cp -r /var/lib/postgresql/9.6/base/* /var/lib/postgresql/9.6/main
- echo "Done"
-fi
-
-chmod -R 700 /var/lib/postgresql/9.6/main
-chown -R postgres /var/lib/postgresql/9.6/main
-
-echo "Starting postgres..."
-. /usr/share/postgresql-common/init.d-functions
-start 9.6
-tail -f /var/log/postgresql/postgresql-9.6-main.log