-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from INgandle/feature/postgis-setup
🔨 [Chore] PostGIS 설정
- Loading branch information
Showing
10 changed files
with
87 additions
and
22 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
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,24 @@ | ||
FROM postgres:16.4-bullseye | ||
|
||
# PostGIS 주 버전 설정 | ||
ENV POSTGIS_MAJOR=3 | ||
ENV POSTGIS_VERSION=3.4.2+dfsg-1.pgdg110+1 | ||
|
||
# 필요한 패키지 설치 및 PostGIS 설치 | ||
# 인증서 오류 발생할 경우 ca-certificates 패키지 설치 | ||
RUN apt-get update \ | ||
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ | ||
&& apt-get install -y --no-install-recommends \ | ||
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 | ||
# PostGIS 초기화 스크립트 추가 | ||
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh | ||
# PostGIS 업데이트 스크립트 추가 | ||
COPY ./update-postgis.sh /usr/local/bin | ||
|
||
RUN chmod +x /docker-entrypoint-initdb.d/10_postgis.sh | ||
|
||
ENV POSTGRES_DB=gis |
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,7 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "Loading PostGIS extensions into $POSTGRES_DB" | ||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL | ||
CREATE EXTENSION IF NOT EXISTS postgis; | ||
EOSQL |
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,16 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Perform all actions as $POSTGRES_USER | ||
export PGUSER="$POSTGRES_USER" | ||
|
||
# PostGIS 버전 설정 | ||
POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" | ||
|
||
# $POSTGRES_DB에 PostGIS 설치, 업데이트 | ||
echo "Installing PostGIS extension to $POSTGRES_DB" | ||
psql --dbname="$POSTGRES_DB" -c " | ||
-- Install PostGIS (includes raster) | ||
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; | ||
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; | ||
" |
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
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