-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move files around for easier setup in docker
- Loading branch information
Showing
31 changed files
with
149 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.8.0 | ||
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.10.0 | ||
|
||
RUN apt-get update && apt-get --assume-yes upgrade \ | ||
&& apt-get -qq install -y --no-install-recommends postgresql-common \ | ||
&& apt-get -qq install -y --no-install-recommends yes \ | ||
&& apt-get -qq install -y --no-install-recommends gnupg \ | ||
&& yes '' | sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh \ | ||
&& apt-get -qq install -y --no-install-recommends postgresql-client-16 \ | ||
&& apt-get -qq install -y --no-install-recommends postgresql-client-17 \ | ||
&& apt-get -qq install -y --no-install-recommends make \ | ||
&& apt-get -qq install -y --no-install-recommends g++ \ | ||
&& apt-get -qq install -y --no-install-recommends git \ | ||
&& apt-get -qq install -y --no-install-recommends zip \ | ||
&& apt-get -qq install -y --no-install-recommends unzip \ | ||
&& apt-get -qq install -y --no-install-recommends python3-dev \ | ||
&& apt-get -qq install -y --no-install-recommends parallel \ | ||
&& apt-get -qq install -y --no-install-recommends python3-pip \ | ||
&& apt-get -qq install -y --no-install-recommends python3-dev \ | ||
&& apt-get -qq install -y --no-install-recommends python3-venv \ | ||
&& apt-get -qq install -y --no-install-recommends python3-psycopg2 \ | ||
&& pip3 install --upgrade numpy \ | ||
&& pip3 install bcdata \ | ||
&& pip3 install rasterstats \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ | ||
&& unzip awscliv2.zip \ | ||
&& ./aws/install | ||
|
||
RUN python3 -m venv /opt/venv && \ | ||
/opt/venv/bin/python -m pip install -U pip && \ | ||
/opt/venv/bin/python -m pip install --no-cache-dir --upgrade numpy && \ | ||
/opt/venv/bin/python -m pip install --no-cache-dir rasterstats && \ | ||
/opt/venv/bin/python -m pip install --no-cache-dir bcdata | ||
|
||
WORKDIR /home/fwapg | ||
|
||
COPY ["db", "db/"] | ||
COPY ["extras", "extras/"] | ||
COPY [".env.docker", "Makefile", "./"] | ||
COPY [".env.docker", "Makefile", "./"] | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
PSQL="psql $DATABASE_URL -v ON_ERROR_STOP=1" | ||
|
||
$PSQL -f sql/schemas.sql | ||
$PSQL -f sql/extensions.sql | ||
|
||
echo "ALTER DATABASE :db SET search_path TO public,whse_basemapping,usgs,hydrosheds" | | ||
$PSQL -v db=$(echo $DATABASE_URL | cut -d "/" -f 4) | ||
|
||
$PSQL -f sql/tables.sql | ||
$PSQL -f sql/views.sql | ||
$PSQL -f sql/functions/CDB_MakeHexagon.sql | ||
$PSQL -f sql/functions/ST_Safe_Repair.sql | ||
$PSQL -f sql/functions/FWA_Downstream.sql | ||
$PSQL -f sql/functions/FWA_Upstream.sql | ||
$PSQL -f sql/functions/huc12.sql | ||
$PSQL -f sql/functions/hydroshed.sql | ||
$PSQL -f sql/functions/FWA_SliceWatershedAtPoint.sql | ||
$PSQL -f sql/functions/FWA_WatershedAtMeasure.sql | ||
$PSQL -f sql/functions/FWA_WatershedHex.sql | ||
$PSQL -f sql/functions/FWA_WatershedStream.sql | ||
$PSQL -f sql/functions/FWA_UpstreamBorderCrossings.sql | ||
$PSQL -f sql/functions/FWA_IndexPoint.sql | ||
$PSQL -f sql/functions/FWA_LocateAlong.sql | ||
$PSQL -f sql/functions/FWA_LocateAlongInterval.sql | ||
$PSQL -f sql/functions/FWA_UpstreamTrace.sql | ||
$PSQL -f sql/functions/postgisftw.sql # pg_fs/pg_ts functions |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. | ||
# | ||
|
||
FROM postgres:17-bullseye | ||
|
||
LABEL maintainer="PostGIS Project - https://postgis.net" \ | ||
org.opencontainers.image.description="PostGIS 3.5.0+dfsg-1.pgdg110+1 spatial database extension with PostgreSQL 17 bullseye" \ | ||
org.opencontainers.image.source="https://github.com/postgis/docker-postgis" | ||
|
||
ENV POSTGIS_MAJOR 3 | ||
ENV POSTGIS_VERSION 3.5.0+dfsg-1.pgdg110+1 | ||
|
||
RUN apt-get update \ | ||
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ | ||
&& apt-get install -y --no-install-recommends \ | ||
# ca-certificates: for accessing remote raster files; | ||
# fix: https://github.com/postgis/docker-postgis/issues/307 | ||
ca-certificates \ | ||
\ | ||
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \ | ||
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir -p /docker-entrypoint-initdb.d | ||
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh | ||
COPY ./update-postgis.sh /usr/local/bin | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
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 postgis_topology; | ||
-- Reconnect to update pg_setting.resetval | ||
-- See https://github.com/postgis/docker-postgis/issues/288 | ||
\c | ||
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; | ||
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; | ||
EOSQL | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Perform all actions as $POSTGRES_USER | ||
export PGUSER="$POSTGRES_USER" | ||
|
||
POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" | ||
|
||
# Load PostGIS into both template_database and $POSTGRES_DB | ||
for DB in template_postgis "$POSTGRES_DB" "${@}"; do | ||
echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" | ||
psql --dbname="$DB" -c " | ||
-- Upgrade PostGIS (includes raster) | ||
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; | ||
-- Upgrade Topology | ||
CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; | ||
-- Install Tiger dependencies in case not already installed | ||
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; | ||
-- Upgrade US Tiger Geocoder | ||
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; | ||
" | ||
done |