diff --git a/Dockerfile b/Dockerfile index 3a5005c..fcb7397 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,22 +64,22 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ apt-get install -y --no-install-recommends libgomp1 libsndfile1; \ fi -# Non-root user -RUN useradd -m -s /bin/bash appuser -USER appuser - -COPY --chown=appuser --from=load_model /cache /cache - -WORKDIR /app ARG TORCH_HOME ARG HF_HOME ENV TORCH_HOME=${TORCH_HOME} ENV HF_HOME=${HF_HOME} +COPY --chown=1001 --from=load_model ${TORCH_HOME} ${TORCH_HOME} +COPY --chown=1001 --from=load_model ${HF_HOME} ${HF_HOME} + ARG WHISPER_MODEL ENV WHISPER_MODEL=${WHISPER_MODEL} ARG LANG ENV LANG=${LANG} +RUN useradd -m -s /bin/bash 1001 +USER 1001 +WORKDIR /app + STOPSIGNAL SIGINT ENTRYPOINT whisperx --model ${WHISPER_MODEL} --language ${LANG} $@ diff --git a/Dockerfile.no_model b/Dockerfile.no_model index a382dda..ab1a0ba 100644 --- a/Dockerfile.no_model +++ b/Dockerfile.no_model @@ -36,13 +36,6 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ apt-get install -y --no-install-recommends libgomp1 libsndfile1; \ fi -# Non-root user -RUN useradd -m -s /bin/bash appuser \ - && mkdir -p /cache \ - && chown -R appuser:appuser /cache -USER appuser - -WORKDIR /app ARG TORCH_HOME ARG HF_HOME ENV TORCH_HOME=${TORCH_HOME} @@ -53,5 +46,11 @@ ENV WHISPER_MODEL=${WHISPER_MODEL} ARG LANG ENV LANG=${LANG} +RUN useradd -m -s /bin/bash 1001 && \ + mkdir -p ${TORCH_HOME} && chown 1001:1001 ${TORCH_HOME} && \ + mkdir -p ${HF_HOME} && chown 1001:1001 ${HF_HOME} +USER 1001 +WORKDIR /app + STOPSIGNAL SIGINT ENTRYPOINT whisperx $@ diff --git a/Dockerfile.ubi b/Dockerfile.ubi index 4911c3d..9e27fc8 100644 --- a/Dockerfile.ubi +++ b/Dockerfile.ubi @@ -54,8 +54,6 @@ RUN python3 load_align_model.py ${LANG} FROM python as final -USER 1001 - # ffmpeg COPY --link --from=mwader/static-ffmpeg:6.0 /ffmpeg /usr/local/bin/ COPY --link --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/ @@ -63,18 +61,21 @@ COPY --link --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/ # Copy venv COPY --link --from=build /venv /venv -COPY --chown=1001 --from=load_model /cache /cache - -WORKDIR /app ARG TORCH_HOME ARG HF_HOME ENV TORCH_HOME=${TORCH_HOME} ENV HF_HOME=${HF_HOME} +COPY --chown=1001 --from=load_model ${TORCH_HOME} ${TORCH_HOME} +COPY --chown=1001 --from=load_model ${HF_HOME} ${HF_HOME} + ARG WHISPER_MODEL ENV WHISPER_MODEL=${WHISPER_MODEL} ARG LANG ENV LANG=${LANG} +USER 1001 +WORKDIR /app + STOPSIGNAL SIGINT ENTRYPOINT whisperx --model ${WHISPER_MODEL} --language ${LANG} $@ diff --git a/Dockerfile.ubi-no_model b/Dockerfile.ubi-no_model index b83b16e..7bfbbbb 100644 --- a/Dockerfile.ubi-no_model +++ b/Dockerfile.ubi-no_model @@ -28,8 +28,6 @@ RUN --mount=type=cache,target=/root/.cache/pip pip install /code FROM python as final -USER 1001 - # ffmpeg COPY --link --from=mwader/static-ffmpeg:6.0 /ffmpeg /usr/local/bin/ COPY --link --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/ @@ -37,16 +35,21 @@ COPY --link --from=mwader/static-ffmpeg:6.0 /ffprobe /usr/local/bin/ # Copy venv COPY --link --from=build /venv /venv -WORKDIR /app ARG TORCH_HOME ARG HF_HOME ENV TORCH_HOME=${TORCH_HOME} ENV HF_HOME=${HF_HOME} +RUN mkdir -p ${TORCH_HOME} && chown 1001:1001 ${TORCH_HOME} +RUN mkdir -p ${HF_HOME} && chown 1001:1001 ${HF_HOME} + ARG WHISPER_MODEL ENV WHISPER_MODEL=${WHISPER_MODEL} ARG LANG ENV LANG=${LANG} +USER 1001 +WORKDIR /app + STOPSIGNAL SIGINT ENTRYPOINT whisperx $@