Improve docker files and use a non-root user

This commit is contained in:
ekoc committed 2025-03-14 14:14:18 +01:00
1 parent 2bd1a5b43b
commit 4041defb8d
7 files changed
+40 -35

No files matched your search

+10 -15
View File
@@ -5,11 +5,7 @@ FROM ${DOCKER_REPOSITORY}alltalk_tts_environment:${DOCKER_TAG}
ARG DEEPSPEED_VERSION=0.16.3
ENV DEEPSPEED_VERSION=$DEEPSPEED_VERSION
##############################################################################
# Directories:
##############################################################################
ENV STAGE_DIR=/tmp
RUN mkdir -p ${STAGE_DIR}
WORKDIR ${ALLTALK_DIR}
##############################################################################
# Install python dependencies
@@ -27,8 +23,8 @@ EOR
# Clone DeepSpeed sources
##############################################################################
RUN <<EOR
git clone https://github.com/microsoft/DeepSpeed.git ${STAGE_DIR}/DeepSpeed
cd ${STAGE_DIR}/DeepSpeed
git clone https://github.com/microsoft/DeepSpeed.git ${ALLTALK_DIR}/DeepSpeed
cd ${ALLTALK_DIR}/DeepSpeed
git checkout .
git checkout "tags/v${DEEPSPEED_VERSION}" -b "v${DEEPSPEED_VERSION}"
@@ -46,21 +42,20 @@ EOR
# Create DeepSpeed build file
##############################################################################
RUN <<EOR
cat << EOF > build_deepspeed.sh
cat << EOF > ${ALLTALK_DIR}/build_deepspeed.sh
#!/usr/bin/env bash
source ~/.bashrc
mkdir -p /deepspeed
source ${ALLTALK_DIR}/conda_env.sh
mkdir -p ${ALLTALK_DIR}/build
conda activate alltalk
cd ${STAGE_DIR}/DeepSpeed
cd ${ALLTALK_DIR}/DeepSpeed
DS_BUILD_OPS=1 python setup.py build_ext -j8 bdist_wheel
mv ${STAGE_DIR}/DeepSpeed/dist/*.whl /deepspeed/
mv ${ALLTALK_DIR}/DeepSpeed/dist/*.whl ${ALLTALK_DIR}/build
EOF
EOR
RUN chmod +x /build_deepspeed.sh
RUN chmod +x ${ALLTALK_DIR}/build_deepspeed.sh
##############################################################################
# Build DeepSpeed:
##############################################################################
ENTRYPOINT ["/build_deepspeed.sh"]
ENTRYPOINT ["bash", "-c", "-l", "$ALLTALK_DIR/build_deepspeed.sh"]
+2 -2
View File
@@ -7,6 +7,7 @@ cd $SCRIPT_DIR
DOCKER_TAG=latest
DOCKER_REPOSITORY=erew123
ALLTALK_DIR=/home/alltalk
# Parse arguments
while [ "$#" -gt 0 ]; do
@@ -67,6 +68,5 @@ docker run \
-it \
--gpus=all \
--name deepspeed \
--build-arg DOCKER_TAG=$DOCKER_TAG \
-v $SCRIPT_DIR/build:/deepspeed \
-v $SCRIPT_DIR/build:${ALLTALK_DIR}/build \
${DOCKER_REPOSITORY}alltalk_deepspeed:${DOCKER_TAG}