This commit is contained in:
cracklesparkle
2024-11-25 11:09:57 +09:00
commit 2b399fa151
12 changed files with 420 additions and 0 deletions

12
postgres/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM postgres:14 AS base
RUN apt-get update && apt-get install -y locales-all \
&& locale-gen ru_RU.UTF-8 \
&& update-locale LANG=ru_RU.UTF-8
ENV LANG=ru_RU.UTF-8
ENV LC_NUMERIC=ru_RU.UTF-8
COPY ./db /docker-entrypoint-initdb.d
COPY init.sql /docker-entrypoint-initdb.d/

18
postgres/init.sql Normal file
View File

@ -0,0 +1,18 @@
-- Create users
CREATE USER xrad_user WITH ENCRYPTED PASSWORD 'xrad_user';
CREATE USER app_user WITH ENCRYPTED PASSWORD 'app_user';
-- Grant SUPERUSER privileges
ALTER USER xrad_user WITH SUPERUSER;
ALTER USER app_user WITH SUPERUSER;
-- Create databases and set owners
CREATE DATABASE xraddb OWNER xrad_user;
CREATE DATABASE appdb OWNER app_user;
-- Restore the database dumps
\connect xraddb;
\i /docker-entrypoint-initdb.d/xraddb.xsquare.pgsql;
\connect appdb;
\i /docker-entrypoint-initdb.d/appdb.xsquare.pgsql;