init
This commit is contained in:
12
postgres/Dockerfile
Normal file
12
postgres/Dockerfile
Normal 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
18
postgres/init.sql
Normal 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;
|
Reference in New Issue
Block a user