Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: '3'

services:
db:
image: postgres
container_name: db
volumes:
- ./docker/data:/var/lib/postgresql/data
- ./docker/init-user-db.sh:/docker-entrypoint-initdb.d/init-user-db.sh
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=test
- POSTGRES_INITDB_ARGS=--encoding=UTF-8
user: postgres
ports:
- "5432:5432"

backend:
image: node:lts-alpine3.13
container_name: backend
env_file: ./backend/.env
volumes:
- ./backend:/backend
working_dir: /backend
ports:
- "5000:5000"
depends_on:
- db
entrypoint: >
sh -c "npm install
&& npm run start:dev"

frontend:
image: node:lts-alpine3.13
container_name: frontend
env_file: ./frontend/.env
volumes:
- ./frontend:/frontend
working_dir: /frontend
ports:
- "3000:3000"
entrypoint: >
sh -c "npm install
&& npm start"

9 changes: 9 additions & 0 deletions docker/init-user-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER hysimok;
CREATE DATABASE t11e;
GRANT ALL PRIVILEGES ON DATABASE t11e TO hysimok;
EOSQL