From a6814fc3fe3bf079230b15056be2f947d6d802d9 Mon Sep 17 00:00:00 2001 From: Yasuyuki Takeo Date: Wed, 3 Jul 2024 12:54:58 +0900 Subject: [PATCH] Add Docker and docker-compoes --- docker-compose.yml | 18 ++++++++++++++++++ frontend/Dockerfile | 14 ++++++++++++++ frontend/package.json | 1 + 3 files changed, 33 insertions(+) create mode 100644 docker-compose.yml create mode 100644 frontend/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7d19413 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3.8' + +services: + frontend: + build: + context: ./frontend + dockerfile: Dockerfile + volumes: + - ./frontend:/app + - node_modules_volume:/app/node_modules + command: sh -c "pnpm run start" + ports: + - "5173:5173" + environment: + - CHOKIDAR_USEPOLLING=true + - NODE_ENV=development +volumes: + node_modules_volume: \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..e2ab030 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,14 @@ +# Use official Node.js image as the base image +FROM node:20.13.1 + +# Set the working directory +WORKDIR /app + +# Copy package.json and pnpm-lock.yaml files +COPY package.json pnpm-lock.yaml ./ + +# Install pnpm +RUN npm install -g pnpm + +# Install dependencies +RUN pnpm install diff --git a/frontend/package.json b/frontend/package.json index adc405d..24d4287 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "vite", + "start": "vite --host", "build": "tsc -b && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview",