Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Dockerfile and .dockerignore for containerization #508

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.


# ============================
# 1. Version Control
# ============================

# Ignore Git repository files
.git
.gitignore

# Ignore GitHub specific files and directories
.github/

# ============================
# 2. Python Artifacts
# ============================

# Ignore Python cache directories and compiled files
__pycache__/
*.pyc
*.pyo
*.pyd

# Ignore C extensions
*.so

# ============================
# 3. Build and Distribution
# ============================

# Ignore build directories
build/
dist/
*.egg-info/
*.eggs/

# Ignore PyInstaller artifacts
*.manifest
*.spec

# ============================
# 4. Virtual Environments
# ============================

# Ignore virtual environment directories
venv/
env/
ENV/
.venv/
.env/

# ============================
# 5. Docker Files
# ============================

# Optionally ignore Dockerfile and .dockerignore if not needed inside the image
Dockerfile
.dockerignore

# ============================
# 6. Logs and Temporary Files
# ============================

# Ignore log files
*.log

# Ignore temporary files and backups
tmp/
*.tmp
*.bak

# ============================
# 7. Data and Models
# ============================

# Exclude datasets and models if they are large and intended to be mounted as volumes
dataset/
data/
models/

# ============================
# 8. Documentation and Examples
# ============================

# Ignore documentation and example directories
docs/
demos/
egs/
model_cards/

# ============================
# 9. Tests
# ============================

# Ignore test directories
tests/
tests_integ/

# ============================
# 10. IDE and Editor Configurations
# ============================

# Ignore Visual Studio Code configurations
.vscode/

# Ignore PyCharm configurations
.idea/

# Ignore Sublime Text projects
*.sublime-project
*.sublime-workspace

# Ignore Atom configurations
.atom/

# Ignore Emacs temporary files
*~
\#*\#

# Ignore Vim swap files
*.swp
*.swo
*.swn

# ============================
# 11. Operating System Files
# ============================

# Ignore macOS Finder metadata
.DS_Store

# Ignore Windows thumbnail caches
Thumbs.db
ehthumbs.db

# ============================
# 12. CI/CD Configurations
# ============================

# Ignore Continuous Integration directories and files
.circleci/
.travis.yml
.github/workflows/
79 changes: 79 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

# #Let's Use NVIDIA's CUDA base image with Python 3.9 and cuDNN 8
FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu20.04

# Then Setup environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV AUDIOCRAFT_CACHE_DIR=/app/cache

# # Set DEBIAN_FRONTEND to noninteractive to disable prompts
ENV DEBIAN_FRONTEND=noninteractive

# Build argument for timezone with default value 'Etc/UTC'
ARG TIMEZONE=Etc/UTC

# Furhet we Set the working directory
WORKDIR /app

#TO Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.9 \
python3.9-venv \
python3-pip \
python3.9-dev \
ffmpeg \
build-essential \
git \
libsndfile1-dev \
libffi-dev \
cython \
tzdata \
&& rm -rf /var/lib/apt/lists/*

# Preconfigure timezone
RUN ln -fs /usr/share/zoneinfo/${TIMEZONE} /etc/localtime && \
echo "${TIMEZONE}" > /etc/timezone && \
dpkg-reconfigure --frontend noninteractive tzdata


# Also, we Create a symlink for python
RUN ln -s /usr/bin/python3.9 /usr/bin/python

# Then Upgrade pip
COPY requirements.txt .
RUN python -m pip install --upgrade pip setuptools wheel

# Install Python packages with --no-binary for pesq
RUN pip install --no-binary=pesq -r requirements.txt

# Copy the rest of the application code
COPY . .

# Install the package in editable mode
# COPY setup.py .
RUN pip install -e .

# (Optional) Install additional dependencies for optional features (e.g., watermarking)
# Uncomment the following line if you need to install extras
# RUN pip install -e '.[wm]'

# (Optional) Create a non-root user for enhanced security
# RUN useradd -m audiocraftuser && chown -R audiocraftuser:audiocraftuser /app
# USER audiocraftuser

# Expose necessary ports if this application serves a web interface or API though
# i can't find any
# EXPOSE 8000

# Define the default command to run the training script
CMD ["python", "train.py"]