From 5f8fdf91174c9354b53fed1ca14a7ad1f5979633 Mon Sep 17 00:00:00 2001 From: wengchaoxi Date: Fri, 29 Mar 2024 15:30:57 +0800 Subject: [PATCH 1/2] feat: Add support for docker deploy --- .dockerignore | 44 ++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++- Dockerfile | 16 ++++++++++++++++ docker-compose.yml | 9 +++++++++ 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..aa5d93b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,44 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local +.env + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +.idea + +public/ +Dockerfile +docker-compose.yml +README*.md diff --git a/.gitignore b/.gitignore index 43163e9..b7fe63c 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel @@ -35,4 +36,4 @@ yarn-error.log* *.tsbuildinfo next-env.d.ts -.idea \ No newline at end of file +.idea diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13da09e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# syntax=docker/dockerfile:1 + +FROM node:lts-alpine AS builder +WORKDIR /src +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +FROM node:lts-alpine +WORKDIR /app +COPY package*.json ./ +RUN npm install --only=production +COPY --from=builder /src/.next ./.next +EXPOSE 3000 +CMD ["npm", "run", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2415ba4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3' + +services: + suno-api: + build: . + volumes: + - ./public:/app/public + ports: + - "3000:3000" From 076556f09c8090822d4b77be652ad7513d43c8b8 Mon Sep 17 00:00:00 2001 From: wengchaoxi Date: Fri, 29 Mar 2024 15:50:55 +0800 Subject: [PATCH 2/2] docs: Update README --- README.md | 6 ++++++ README_CN.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 0a9ae81..a90a180 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,12 @@ cd suno-api npm install ``` +Alternatively, you can use [Docker Compose](https://docs.docker.com/compose/) + +```bash +docker compose build && docker compose up +``` + ### 3. Configure suno-api - If deployed to Vercel, please add an environment variable `SUNO_COOKIE` in the Vercel dashboard, with the value of the cookie obtained in the first step. diff --git a/README_CN.md b/README_CN.md index 251d43e..067f069 100644 --- a/README_CN.md +++ b/README_CN.md @@ -56,6 +56,12 @@ cd suno-api npm install ``` +或者,你也可以使用 [Docker Compose](https://docs.docker.com/compose/) + +```bash +docker compose build && docker compose up +``` + ### 3. 配置 suno-api - 如果部署到了 Vercel,请在 Vercel 后台,添加环境变量 `SUNO_COOKIE`,值为第一步获取的 cookie。