diff --git a/Dockerfile b/Dockerfile index 8b2e852..78d7613 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,9 @@ COPY tests ./tests/ COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt +ENV HF_DATASETS_CACHE /data/hf/datasets +RUN ./sscli admin init-db + RUN chmod +x ./entrypoint.sh #RUN chown -R www:www ${WORKROOT} . diff --git a/entrypoint.sh b/entrypoint.sh index 562ffac..3ba294f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,14 +9,12 @@ else export FLASK_ENV="production" fi -host=${TXL_WEBAPP_HOST:-"0.0.0.0"} -port=${TXL_WEBAPP_PORT:-"8000"} - -./sscli admin init-db - # Preload Thai model. python -c 'from esupar import load; load("th")' +host=${TXL_WEBAPP_HOST:-"0.0.0.0"} +port=${TXL_WEBAPP_PORT:-"8000"} + if [ "${FLASK_ENV}" == "development" ]; then exec flask run -h $host -p $port else diff --git a/scriptshifter_base.Dockerfile b/scriptshifter_base.Dockerfile index 9cd06c3..4a66ddb 100644 --- a/scriptshifter_base.Dockerfile +++ b/scriptshifter_base.Dockerfile @@ -10,6 +10,8 @@ RUN addgroup --system www RUN adduser --system www RUN gpasswd -a www www +ENV HF_DATASETS_CACHE /data/hf/datasets + # Copy external dependencies. WORKDIR ${WORKROOT} COPY ext ./ext/