Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 로컬 DB 세팅 및 mikro-orm CLI 세팅, cache 도메인 구현 #69

Merged
merged 2 commits into from
Oct 9, 2024
Merged
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
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
Loading