Skip to content

Commit

Permalink
Update docker script
Browse files Browse the repository at this point in the history
  • Loading branch information
Artrajz committed Aug 25, 2024
1 parent 480a9dd commit b0c9ef2
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 161 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN apt-get update && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/*


# Install jemalloc
RUN wget https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 && \
tar -xvf jemalloc-5.3.0.tar.bz2 && \
Expand All @@ -32,6 +33,10 @@ RUN pip install gunicorn --no-cache-dir && \
rm -rf /root/.cache/pip/*

COPY . /app
COPY data /data_bak

RUN chmod +x /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]

EXPOSE 23456

Expand Down
5 changes: 5 additions & 0 deletions Dockerfile_GPU
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive


RUN apt-get update && \
apt-get install -yq build-essential espeak-ng cmake wget ca-certificates tzdata&& \
update-ca-certificates && \
Expand Down Expand Up @@ -32,6 +33,10 @@ RUN pip install gunicorn --no-cache-dir && \
rm -rf /root/.cache/pip/*

COPY . /app
COPY data /data_bak

RUN chmod +x /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]

EXPOSE 23456

Expand Down
10 changes: 5 additions & 5 deletions docker-compose-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ services:
- 23456:23456
environment:
LANG: 'C.UTF-8'
TZ: Asia/Shanghai #timezone
command: [ 'python', 'app.py' ] # 目前用不了gunicorn多进程
TZ: Asia/Shanghai # timezone
command: [ 'python', 'app.py' ]
# command: ["gunicorn", "-c", "gunicorn_config.py", "app:app"]
volumes:
- ./data:/app/data #挂载模型文件夹
# - ./config.py:/app/config.py # 挂载配置文件
- ./config.yaml:/app/config.yaml # 挂载配置文件
- ./data:/app/data # model data folder
- ./config.yaml:/app/config.yaml # service configuration
- ./logs:/app/logs # logging logs
- ./gunicorn_config.py:/app/gunicorn_config.py # gunicorn configuration
- ./pyopenjtalk/open_jtalk_dic_utf_8-1.11:/usr/local/lib/python3.10/site-packages/pyopenjtalk/open_jtalk_dic_utf_8-1.11 #pyopentjalk
Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
version: '3.4'
version: '3.8'

services:
vits:
image: artrajz/vits-simple-api:latest
Expand All @@ -7,11 +8,12 @@ services:
- 23456:23456
environment:
LANG: 'C.UTF-8'
TZ: Asia/Shanghai #timezone
TZ: Asia/Shanghai # timezone
command: [ 'python', 'app.py' ]
# command: ["gunicorn", "-c", "gunicorn_config.py", "app:app"]
volumes:
- ./data:/app/data # 挂载模型文件夹
# - ./config.py:/app/config.py # 挂载配置文件
- ./config.yaml:/app/config.yaml # 挂载配置文件
- ./data:/app/data # model data folder
- ./config.yaml:/app/config.yaml # service configuration
- ./logs:/app/logs # logging logs
- ./gunicorn_config.py:/app/gunicorn_config.py # gunicorn configuration
- ./pyopenjtalk/open_jtalk_dic_utf_8-1.11:/usr/local/lib/python3.10/site-packages/pyopenjtalk/open_jtalk_dic_utf_8-1.11 #pyopentjalk
Expand Down
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ ! -d "/app/data" ] || [ -z "$(ls -A /app/data)" ]; then
echo "The host's ./data directory is empty or does not exist. Copying data from the container..."
mkdir -p /app/data
cp -r /data_bak/* /app/data/
fi

exec "$@"
Loading

0 comments on commit b0c9ef2

Please sign in to comment.