Merge pull request #2 from wengchaoxi/support-docker
feat: Add support for docker build and deploy
This commit is contained in:
		
						commit
						8ad6304110
					
				
							
								
								
									
										44
									
								
								.dockerignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								.dockerignore
									
									
									
									
									
										Normal 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
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -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
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
									
									
									
									
										Normal 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"]
 | 
			
		||||
@ -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.
 | 
			
		||||
 | 
			
		||||
@ -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
									
								
							
							
						
						
									
										9
									
								
								docker-compose.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
version: '3'
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  suno-api:
 | 
			
		||||
    build: .
 | 
			
		||||
    volumes:
 | 
			
		||||
      - ./public:/app/public
 | 
			
		||||
    ports:
 | 
			
		||||
      - "3000:3000"
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user