naicoi commited on
Commit
6cf6986
Β·
1 Parent(s): 9ef6261

github actions

Browse files
Files changed (4) hide show
  1. .dockerignore +38 -0
  2. .github/workflows/docker.yml +57 -0
  3. Dockerfile +43 -0
  4. docker-compose.yml +19 -0
.dockerignore ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+
11
+ # Virtual Environment
12
+ .venv/
13
+ venv/
14
+
15
+ # Cache
16
+ .cache/
17
+ *.log
18
+ *.tmp
19
+
20
+ # Output directories
21
+ processed_results/
22
+
23
+ # IDE
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+
28
+ # Git
29
+ .git/
30
+ .gitignore
31
+
32
+ # Documentation
33
+ *.md
34
+ !README.md
35
+
36
+ # Test
37
+ tests/
38
+ eval/
.github/workflows/docker.yml ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Push to GHCR
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - 'v*'
9
+ workflow_dispatch:
10
+
11
+ env:
12
+ REGISTRY: ghcr.io
13
+ IMAGE_NAME: ${{ github.repository }}
14
+
15
+ jobs:
16
+ build:
17
+ runs-on: ubuntu-latest
18
+ permissions:
19
+ contents: read
20
+ packages: write
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Set up Docker Buildx
27
+ uses: docker/setup-buildx-action@v3
28
+
29
+ - name: Log in to GHCR
30
+ uses: docker/login-action@v3
31
+ with:
32
+ registry: ${{ env.REGISTRY }}
33
+ username: ${{ github.actor }}
34
+ password: ${{ secrets.GITHUB_TOKEN }}
35
+
36
+ - name: Extract metadata
37
+ id: meta
38
+ uses: docker/metadata-action@v5
39
+ with:
40
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41
+ tags: |
42
+ type=ref,event=branch
43
+ type=ref,event=pr
44
+ type=semver,pattern={{version}}
45
+ type=semver,pattern={{major}}.{{minor}}
46
+ type=sha,prefix=
47
+
48
+ - name: Build and push
49
+ uses: docker/build-push-action@v5
50
+ with:
51
+ context: .
52
+ push: true
53
+ tags: ${{ steps.meta.outputs.tags }}
54
+ labels: ${{ steps.meta.outputs.labels }}
55
+ platforms: linux/amd64
56
+ cache-from: type=gha
57
+ cache-to: type=gha,mode=max
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use CUDA 12.1 base image with cuDNN
2
+ FROM nvidia/cuda:12.1-cudnn8-runtime-ubuntu22.04
3
+
4
+ # Install Python and uv
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ python3.10 \
7
+ python3.10-venv \
8
+ python3-pip \
9
+ curl \
10
+ ffmpeg \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Install uv
14
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
15
+ ENV PATH="$HOME/.cargo/bin:$PATH"
16
+
17
+ # Create virtual environment
18
+ RUN uv venv /opt/venv
19
+ ENV PATH="/opt/venv/bin:$PATH"
20
+
21
+ # Install dependencies
22
+ COPY requirements.txt .
23
+ RUN uv pip install --system -r requirements.txt
24
+
25
+ WORKDIR /app
26
+
27
+ # Copy application code
28
+ COPY . .
29
+
30
+ # Setup checkpoints directory
31
+ RUN mkdir -p ~/.cache/torch/hub/checkpoints
32
+ COPY checkpoints/* ~/.cache/torch/hub/checkpoints/ 2>/dev/null || true
33
+
34
+ # Create output directory
35
+ RUN mkdir -p /app/processed_results
36
+
37
+ # Set environment variables
38
+ ENV PYTHONUNBUFFERED=1
39
+ ENV PROCESSED_RESULTS=/app/processed_results
40
+
41
+ EXPOSE 7860
42
+
43
+ CMD ["python", "app.py"]
docker-compose.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+
3
+ services:
4
+ silent-wolf:
5
+ build: .
6
+ ports:
7
+ - "7860:7860"
8
+ volumes:
9
+ - ./processed_results:/app/processed_results
10
+ deploy:
11
+ resources:
12
+ reservations:
13
+ devices:
14
+ - driver: nvidia
15
+ count: all
16
+ capabilities: [gpu]
17
+ environment:
18
+ - PYTHONUNBUFFERED=1
19
+ - PROCESSED_RESULTS=/app/processed_results