Skip to content

Commit

Permalink
feat: 로컬 DB 세팅 및 mikro-orm CLI 세팅, cache 도메인 구현 (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coalery authored Oct 9, 2024
2 parents 0b8dfdf + 5ad10cd commit ea0baee
Show file tree
Hide file tree
Showing 11 changed files with 837 additions and 412 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

10 changes: 10 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Database
DATABASE_HOST=localhost
DATABASE_PORT=3306
DATABASE_USER=root
DATABASE_PASSWORD=test
DATABASE_NAME=khlug

# Authentication
APP_KEY=appKeySecret
SESSION_STORAGE_PATH=
1 change: 1 addition & 0 deletions .mysql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS khlug;
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.18.0-alpine as builder
FROM node:20-alpine as builder

ENV NODE_ENV build
WORKDIR /sight
Expand All @@ -9,7 +9,7 @@ RUN npm ci
RUN npm run build \
&& npm prune --production

FROM node:18.18.0-alpine
FROM node:20-alpine

ENV NODE_ENV production
WORKDIR /sight
Expand Down
29 changes: 28 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
version: '3.8'

services:
mysql:
image: mysql:8.0
container_name: mysql
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=test
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
volumes:
- ./.mysql/:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-hlocalhost", "-ptest"]
interval: 5s
timeout: 1s
retries: 20
start_period: 5s

sight:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "3000:3000"
- 3000:3000
environment:
- NODE_ENV=development
depends_on:
mysql:
condition: service_healthy
12 changes: 12 additions & 0 deletions mikro-orm.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from '@mikro-orm/mysql';

import { EntityModels } from '@khlug/core/persistence/Entities';

export default defineConfig({
entities: EntityModels,
host: 'localhost',
port: 3306,
user: 'root',
password: 'test',
dbName: 'khlug',
});
Loading

0 comments on commit ea0baee

Please sign in to comment.