| # Use a base image with Postgres installed | |
| FROM postgres:15 | |
| # Install curl for downloading PostgREST | |
| RUN apt-get update && apt-get install -y curl | |
| # Define PostgREST version and download URL | |
| ENV POSTGREST_VERSION=11.2.0 | |
| ENV POSTGREST_URL=https://github.com/PostgREST/postgrest/releases/download/v${POSTGREST_VERSION}/postgrest-linux-static | |
| # Download and make PostgREST executable | |
| RUN curl -L $POSTGREST_URL -o /usr/local/bin/postgrest \ | |
| && chmod +x /usr/local/bin/postgrest | |
| # Copy PostgREST config file into container | |
| COPY postgrest.conf /etc/postgrest.conf | |
| # Expose PostgreSQL default port and PostgREST port | |
| EXPOSE 5432 3000 | |
| # Start PostgreSQL and then PostgREST | |
| CMD ["bash", "-c", "docker-entrypoint.sh postgres & sleep 10 && postgrest /etc/postgrest.conf"] | |