Merge pull request #2 from wengchaoxi/support-docker

feat: Add support for docker build and deploy
This commit is contained in:
GitPusher99 2024-03-29 16:16:16 +08:00 committed by GitHub
commit 8ad6304110
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 83 additions and 1 deletions

44
.dockerignore Normal file
View File

@ -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

3
.gitignore vendored
View File

@ -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
.idea

16
Dockerfile Normal file
View File

@ -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"]

View File

@ -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.

View File

@ -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。

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: '3'
services:
suno-api:
build: .
volumes:
- ./public:/app/public
ports:
- "3000:3000"