You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ive seem to be stuck for a couple of days trying to deploy LibreTranslate to Heroku using Docker.
Locally, i have no issue whatsoever, the docker image is working as intended.
The app is building successfully but when running "run.sh", i am getting the following error in heroku console:
2024-06-22T00:47:40.000000+00:00 app[api]: Build succeeded 2024-06-22T00:47:40.618736+00:00 app[api]: Release v22 created by user xxx@gmail.com 2024-06-22T00:47:40.618736+00:00 app[api]: Deploy 371a439d by user xxx@gmail.com 2024-06-22T00:47:41.793013+00:00 heroku[web.1]: State changed from crashed to starting 2024-06-22T00:48:04.419660+00:00 heroku[web.1]: Starting process with command /bin/sh -c /app/run.sh 2024-06-22T00:48:05.068267+00:00 app[web.1]: Starting LibreTranslate... 2024-06-22T00:48:05.068330+00:00 app[web.1]: PORT: 24559 2024-06-22T00:48:05.068330+00:00 app[web.1]: Using port: 24559 2024-06-22T00:49:04.460710+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60seconds of launch 2024-06-22T00:49:04.472926+00:00 heroku[web.1]: Stopping process with SIGKILL 2024-06-22T00:49:04.561711+00:00 heroku[web.1]: Process exited with status 137 2024-06-22T00:49:04.585905+00:00 heroku[web.1]: State changed from starting to crashed
if [ ! -z "$models" ]; then
./venv/bin/python scripts/install_models.py --load_only_lang_codes "$models";
else
./venv/bin/python scripts/install_models.py;
fi
fi
EXPOSE 5000
ENTRYPOINT ["/bin/bash", "/app/run.sh"]
`
And my run.sh:
set -eo pipefail echo "Starting LibreTranslate..." echo "PORT: ${PORT}"
Hello everyone,
Ive seem to be stuck for a couple of days trying to deploy LibreTranslate to Heroku using Docker.
Locally, i have no issue whatsoever, the docker image is working as intended.
The app is building successfully but when running "run.sh", i am getting the following error in heroku console:
2024-06-22T00:47:40.000000+00:00 app[api]: Build succeeded
2024-06-22T00:47:40.618736+00:00 app[api]: Release v22 created by user xxx@gmail.com
2024-06-22T00:47:40.618736+00:00 app[api]: Deploy 371a439d by user xxx@gmail.com
2024-06-22T00:47:41.793013+00:00 heroku[web.1]: State changed from crashed to starting
2024-06-22T00:48:04.419660+00:00 heroku[web.1]: Starting process with command /bin/sh -c /app/run.sh
2024-06-22T00:48:05.068267+00:00 app[web.1]: Starting LibreTranslate...
2024-06-22T00:48:05.068330+00:00 app[web.1]: PORT: 24559
2024-06-22T00:48:05.068330+00:00 app[web.1]: Using port: 24559
2024-06-22T00:49:04.460710+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60
seconds of launch
2024-06-22T00:49:04.472926+00:00 heroku[web.1]: Stopping process with SIGKILL
2024-06-22T00:49:04.561711+00:00 heroku[web.1]: Process exited with status 137
2024-06-22T00:49:04.585905+00:00 heroku[web.1]: State changed from starting to crashed
Here is my Dockerfile:
`
FROM python:3.11.9-slim-bullseye as builder
WORKDIR /app
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq
&& apt-get -qqq install --no-install-recommends -y pkg-config gcc g++
&& apt-get upgrade --assume-yes
&& apt-get clean
&& rm -rf /var/lib/apt
RUN python -m venv venv && ./venv/bin/pip install --no-cache-dir --upgrade pip
COPY . .
RUN ./venv/bin/pip install Babel==2.12.1 && ./venv/bin/python scripts/compile_locales.py
&& ./venv/bin/pip install torch==2.0.1 --extra-index-url https://download.pytorch.org/whl/cpu
&& ./venv/bin/pip install .
&& ./venv/bin/pip cache purge
FROM python:3.11.9-slim-bullseye
ARG with_models=false
ARG models=""
RUN addgroup --system --gid 1032 libretranslate && adduser --system --uid 1032 libretranslate && mkdir -p /home/libretranslate/.local && chown -R libretranslate:libretranslate /home/libretranslate/.local
USER libretranslate
COPY --from=builder --chown=1032:1032 /app /app
WORKDIR /app
COPY --from=builder --chown=1032:1032 /app/venv/bin/ltmanage /usr/bin/
RUN if [ "$with_models" = "true" ]; then \
if [ ! -z "$models" ]; then
./venv/bin/python scripts/install_models.py --load_only_lang_codes "$models";
else
./venv/bin/python scripts/install_models.py;
fi
fi
EXPOSE 5000
ENTRYPOINT ["/bin/bash", "/app/run.sh"]
`
And my run.sh:
set -eo pipefail
echo "Starting LibreTranslate..."
echo "PORT: ${PORT}"
PORT=${PORT:-5000}
echo "Using port: ${PORT}"
./venv/bin/libretranslate --host 0.0.0.0 --port $PORT &> /app/libretranslate.log
The text was updated successfully, but these errors were encountered: