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

Simplify docker build. 简化dockerfile #18

Merged
merged 1 commit into from
Jun 5, 2024
Merged
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
21 changes: 4 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
# Use an official NVIDIA runtime with CUDA and Miniconda as a parent image
FROM nvidia/cuda:12.2.0-base-ubuntu22.04
FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime

# Install Miniconda
RUN apt-get update && apt-get install -y wget
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
RUN bash ~/miniconda.sh -b -p $HOME/miniconda
ENV PATH="/root/miniconda/bin:${PATH}"
RUN conda init bash
RUN apt-get update && apt-get install ffmpeg -y

# Set the working directory in the container to /app
WORKDIR /app

# Add the current directory contents into the container at /app
ADD . /app

# Create a conda environment with the necessary packages
RUN conda create -n pvtvzhen python=3.9

# Make RUN commands use the new environment
SHELL ["conda", "run", "-n", "pvtvzhen", "/bin/bash", "-c"]

# Install dependencies
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
RUN conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

Expand All @@ -32,7 +19,7 @@ EXPOSE 8080
# Define environment variable
ENV FLASK_RUN_PORT 8080
ENV FLASK_APP app.py
ENV FLASK_DEBUG 1
ENV FLASK_DEBUG 0

# Run app.py when the container launches
CMD [ "/bin/bash", "-c", "source activate pvtvzhen && python3 -m flask run --host=0.0.0.0" ]
CMD [ "/bin/bash", "-c", "python -m flask run --host=0.0.0.0" ]
1 change: 0 additions & 1 deletion work_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ def srtToVoiceEdge(logger, srtFileNameAndPath, outputDir, character="zh-CN-Xiaoy
fileMp3Names = []

async def convertSrtToVoiceEdge(text, path):
print(f"Start to convert srt to voice into {path}, text: {text}")
communicate = edge_tts.Communicate(text, character)
await communicate.save(path)

Expand Down
Loading