From 287786f30ab050c9fd32ade9d4e31f8795e4bd16 Mon Sep 17 00:00:00 2001 From: ayuki_j <19406594+ayuki-joto@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:10:14 +0900 Subject: [PATCH] fix: local docker postgres --- docker-compose.yml | 6 +++--- docker/postgres/Dockerfile | 15 +++++++++++++++ docker/postgres/initdb-pg_bigm.sql | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 docker/postgres/Dockerfile create mode 100644 docker/postgres/initdb-pg_bigm.sql diff --git a/docker-compose.yml b/docker-compose.yml index 46ecc81da..9b729b69f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.8" - x-custom: app: - &rails_env "development" @@ -45,7 +43,9 @@ services: links: - pg pg: - image: postgres:12 + image: postgres + build: + context: docker/postgres/. volumes: - pg-data:/var/lib/postgresql/data environment: diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile new file mode 100644 index 000000000..07c326a03 --- /dev/null +++ b/docker/postgres/Dockerfile @@ -0,0 +1,15 @@ +FROM postgres:12 + +RUN apt update +RUN apt install -y postgresql-server-dev-12 make gcc curl libicu-dev + +RUN cd /tmp && \ + curl -L -O https://github.com/pgbigm/pg_bigm/archive/refs/tags/v1.2-20240606.tar.gz && \ + tar zxf v1.2-20240606.tar.gz && \ + cd pg_bigm-1.2-20240606 && \ + make USE_PGXS=1 && \ + make USE_PGXS=1 install && \ + rm -rf /tmp/pg_bigm-1.2-20240606 /tmp/v1.2-20240606.tar.gz + +RUN mkdir -p /docker-entrypoint-initdb.d +COPY ./initdb-pg_bigm.sql /docker-entrypoint-initdb.d/10_pg_bigm.sql diff --git a/docker/postgres/initdb-pg_bigm.sql b/docker/postgres/initdb-pg_bigm.sql new file mode 100644 index 000000000..7aac902db --- /dev/null +++ b/docker/postgres/initdb-pg_bigm.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS pg_bigm; \ No newline at end of file