feat: postgres docker compose

This commit is contained in:
dhanush.s 2025-09-04 19:30:12 +05:30
commit 2066dc834e
5 changed files with 38 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
.venv
frontend

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "backend"]
path = backend
url = git@git.opsmonsters.in:opsmonsters/lolita-backend.git

1
backend Submodule

@ -0,0 +1 @@
Subproject commit df20ceb45125c259dac552807f2cd08db44cf0e7

18
docker-compose.yaml Normal file
View File

@ -0,0 +1,18 @@
services:
postgres:
image: postgres:15
container_name: my_postgres
restart: unless-stopped
ports:
- "${POSTGRES_PORT}:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
postgres_data:

13
init.sql Normal file
View File

@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
email VARCHAR(255) UNIQUE NOT NULL,
hashed_password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS otps (
id SERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL,
otp VARCHAR(6) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);