Skip to content
Snippets Groups Projects
Verified Commit 8a91c1c9 authored by Gaëtan Blond's avatar Gaëtan Blond
Browse files

[Mobilizon] Fixed db not working

parent e79a07b3
No related branches found
No related tags found
1 merge request!55Mobilizon
FROM postgres:12-alpine
ARG POSTGRES_DB
RUN apk update \
&& apk add --update postgis \
&& rm -rf /tmp/* /var/tmp/*
RUN printf "\\c "$POSTGRES_DB" \n CREATE EXTENSION postgis; \n CREATE EXTENSION pg_trgm; \n CREATE EXTENSION unaccent;" > /docker-entrypoint-initdb.d/setup.sql
# Same Dockerfile as official image, but different extensions :
# https://github.com/postgis/docker-postgis/blob/7639baab95220201b87476b2dd09e011423ebd55/12-3.0/alpine/initdb-postgis.sh
FROM postgis/postgis:12-3.0-alpine
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
#!/bin/sh
set -e
# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"
# Create the 'template_postgis' template db
"${psql[@]}" <<- 'EOSQL'
CREATE DATABASE template_postgis IS_TEMPLATE true;
EOSQL
# Load PostGIS into both template_database and $POSTGRES_DB
for DB in template_postgis "$POSTGRES_DB"; do
echo "Loading PostGIS extensions into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS unaccent;
EOSQL
done
......@@ -60,7 +60,7 @@ services:
context: ./db
dockerfile: Dockerfile
args:
- POSGRES_DB=postgres_mobilizon
- POSTGRES_DB=postgres_mobilizon
container_name: mobilizon-db
volumes:
- mobilizon-db:/var/lib/postgresql/data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment