forked from sorintlab/stolon
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
31 lines (26 loc) · 1.33 KB
/
Dockerfile
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
################################################################################
# build
################################################################################
FROM golang:1.16 AS build
COPY . /go/src/github.com/sorintlab/stolon
WORKDIR /go/src/github.com/sorintlab/stolon
# If we're running goreleaser, then our binaries will already be copied into our
# work directory. Otherwise we should build them.
RUN set -x && \
if [ ! -f stolonctl ]; then \
make && mv -v bin/* .; \
fi
################################################################################
# release
################################################################################
FROM ubuntu:20.04 AS release
RUN set -x \
&& apt-get update -y \
&& apt-get install -y curl gpg \
&& sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main\ndeb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg 14" > /etc/apt/sources.list.d/pgdg.list' \
&& curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common pgbouncer postgresql-client \
&& mkdir -pv /var/run/postgresql /var/log/postgresql
COPY --from=build /go/src/github.com/sorintlab/stolon/stolon* /usr/local/bin/
USER postgres