Created
July 5, 2021 16:55
-
-
Save mveytsman/6a25611958316f4a05becb946d900260 to your computer and use it in GitHub Desktop.
Dockerfile for postgis on fly.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARG PG_VERSION=12.5 | |
ARG VERSION=dev | |
FROM golang:1.16 as flyutil | |
ARG VERSION | |
WORKDIR /go/src/github.com/fly-examples/postgres-ha | |
COPY . . | |
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/flyadmin ./cmd/flyadmin | |
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/flycheck ./cmd/flycheck | |
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /fly/bin/start ./cmd/start | |
FROM flyio/stolon:20210525 as stolon | |
FROM wrouesnel/postgres_exporter:latest AS postgres_exporter | |
FROM postgres:${PG_VERSION} | |
ARG POSTGIS_MAJOR=3 | |
ARG PG_MAJOR=12 | |
LABEL fly.app_role=postgres_cluster | |
LABEL image_version=${VERSION} | |
RUN apt-get update && apt-get install --no-install-recommends -y \ | |
ca-certificates curl bash dnsutils vim-tiny procps jq \ | |
postgis postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR} postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}-scripts \ | |
&& apt autoremove -y | |
COPY --from=stolon /go/src/app/bin/* /usr/local/bin/ | |
COPY --from=postgres_exporter /postgres_exporter /usr/local/bin/ | |
# ADD /bin/* /usr/local/bin/ | |
ADD /scripts/* /fly/ | |
ADD /config/* /fly/ | |
RUN useradd -ms /bin/bash stolon | |
COPY --from=flyutil /fly/bin/* /usr/local/bin/ | |
EXPOSE 5432 | |
CMD ["start"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment