[+] Dockerfile deploy

This commit is contained in:
2025-11-25 01:59:12 +08:00
parent 229f1282db
commit 6c44a3650c
3 changed files with 101 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
WORKDIR /app
# Install system dependencies
# ffmpeg is required for audio processing
# python3 and pip are required since we are using a base cuda image
RUN apt-get update && \
apt-get install -y ffmpeg python3 python3-pip && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies
# We install dependencies globally as this is a container
# Install audio-separator with GPU support
RUN pip3 install --no-cache-dir fastapi uvicorn[standard] audio-separator[gpu] python-multipart
# Copy the server script
COPY scripts/server.py .
EXPOSE 24801
CMD ["python3", "server.py"]
+27
View File
@@ -0,0 +1,27 @@
FROM oven/bun:1 AS builder
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
# Build the application
RUN bun run build
################################################################################
# Production image
FROM oven/bun:1
WORKDIR /app
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
# Note: If using adapter-auto, ensure it resolves to a Node-compatible build.
# If you encounter issues, consider installing @sveltejs/adapter-node and updating svelte.config.js.
CMD ["bun", "./build/index.js"]
+52
View File
@@ -0,0 +1,52 @@
services:
web:
container_name: amaoke-web
build:
context: ..
dockerfile: deploy/Dockerfile.web
ports:
- "3000:3000"
environment:
- ORIGIN=http://localhost:3000
- MONGODB_URI=mongodb://cat:meow@db:27017/amaoke?authSource=admin
- AUDIO_SEPARATOR_API=http://ai:24801
depends_on:
- db
- ai
restart: unless-stopped
ai:
container_name: amaoke-ai
build:
context: ..
dockerfile: deploy/Dockerfile.python
# ports:
# - "24801:24801"
volumes:
- python_temp:/app/temp_audio
- python_cache:/root/.cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
restart: unless-stopped
db:
image: mongo:latest
restart: unless-stopped
container_name: amaoke-db
ports:
- "127.0.0.1:27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: cat
MONGO_INITDB_ROOT_PASSWORD: meow
volumes:
- mongodb_data:/data/db
volumes:
mongodb_data:
python_temp:
python_cache: