From 341e208ea497ce5e04299f43bdf63aad7a547445 Mon Sep 17 00:00:00 2001 From: scarf Date: Sat, 5 Oct 2024 18:18:47 +0900 Subject: [PATCH] build: dev dockerfile --- README.md | 7 +++++++ backend/Dockerfile.dev | 6 ++++++ backend/package.json | 3 ++- compose-dev.yml | 27 +++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 backend/Dockerfile.dev create mode 100644 compose-dev.yml diff --git a/README.md b/README.md index 9d8cd16..8a0d584 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # backend-nest + 6차 개발팀은 nestjs 로 새로 작성하기로 했습니다 + +## 개발용 compose 실행 방법 + +```sh +$ docker compose -f compose-dev.yml up --remove-orphans +``` diff --git a/backend/Dockerfile.dev b/backend/Dockerfile.dev new file mode 100644 index 0000000..e070061 --- /dev/null +++ b/backend/Dockerfile.dev @@ -0,0 +1,6 @@ +FROM node:22-slim AS base +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable + +WORKDIR /app diff --git a/backend/package.json b/backend/package.json index 5199d2d..1554d0b 100644 --- a/backend/package.json +++ b/backend/package.json @@ -76,5 +76,6 @@ ], "coverageDirectory": "../coverage", "testEnvironment": "node" - } + }, + "packageManager": "pnpm@9.12.0+sha512.4abf725084d7bcbafbd728bfc7bee61f2f791f977fd87542b3579dcb23504d170d46337945e4c66485cd12d588a0c0e570ed9c477e7ccdd8507cf05f3f92eaca" } diff --git a/compose-dev.yml b/compose-dev.yml new file mode 100644 index 0000000..6447e92 --- /dev/null +++ b/compose-dev.yml @@ -0,0 +1,27 @@ +services: + database: + platform: linux/x86_64 + container_name: database + image: mysql:8.0 + environment: + - TZ=Asia/Seoul + + ports: + - 3306:3306 + + env_file: .env + + backend: + container_name: backend + restart: on-failure + build: + context: backend + dockerfile: Dockerfile.dev + + entrypoint: ["pnpm", "run", "start:dev"] + volumes: + - ./backend:/app + - ./backend/logs:/app/backend/logs + ports: + - 3000:3000 + env_file: .env