summaryrefslogtreecommitdiff
path: root/build/postgrest/Dockerfile
blob: 9fa8644ccdc258516108ee4739b7a618ddd0fd13 (plain)
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
ARG ALPINE_VERSION="3.23"
ARG POSTGREST_VERSION="14.5"
ARG POSTGREST_ARCH="linux-static-x86-64"
FROM alpine:${ALPINE_VERSION}

# install packages
RUN apk add --no-cache tini wget curl shadow
RUN rm -fr /var/cache/apk/*

# setup main user
RUN adduser -D postgrest
RUN groupmod --gid 1000 postgrest
RUN usermod --uid 1000 postgrest

# install postgrest
ARG POSTGREST_VERSION
ARG POSTGREST_ARCH
RUN wget "https://github.com/PostgREST/postgrest/releases/download/v${POSTGREST_VERSION}/postgrest-v${POSTGREST_VERSION}-${POSTGREST_ARCH}.tar.xz" -O /tmp/postgrest.tar.xz
RUN tar xJf /tmp/postgrest.tar.xz -C /usr/local/bin
RUN rm /tmp/postgrest.tar.xz

# copy scripts
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +rx /usr/local/bin/entrypoint.sh

# remove build packages
RUN apk del shadow

# make the dirs
RUN mkdir -p /etc/postgrest.d && \
	chown postgrest:postgrest /etc/postgrest.d

# do the
USER postgrest
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/local/bin/entrypoint.sh"]