From 787f780863d6b4806a69316d642eabd9c1a188c9 Mon Sep 17 00:00:00 2001 From: sixzeroo Date: Sat, 18 Mar 2023 21:54:51 +0800 Subject: [PATCH] Support using with docker compose --- Dockerfile | 8 ++++++++ README.md | 8 +++++++- docker-compose.yml | 12 ++++++++++++ package.json | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b91f177e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:18 + +ADD . /work +WORKDIR /work + +RUN npm ci + +CMD ["bash"] diff --git a/README.md b/README.md index 47c90779..6e869721 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ npm ci npm run dev # or: npm run build ``` +## Use with docker compose + +```bash +docker compose up -d +``` + ## Contributors @@ -43,4 +49,4 @@ npm run dev # or: npm run build - \ No newline at end of file + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..441060de --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3" + +services: + chatgpt_web: + container_name: chatgpt_web + command: npm run deploy + restart: always + ports: + - 5173:5173 + build: + context: "." + dockerfile: Dockerfile diff --git a/package.json b/package.json index 850ddbe3..6b0f74cf 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "type": "module", "scripts": { "dev": "vite", + "deploy": "vite --host 0.0.0.0", "build": "vite build", "build:github": "vite build --base=/chatgpt-web/", "preview": "vite preview",