#!/bin/bash set -e # ============================================================ # fquiz API Docker Entrypoint # Ensures static assets (tpbig.exe) are available at runtime # locations, even when the /app/data volume is a fresh bind mount. # ============================================================ STATIC_ROOT="/app/static/wine" DATA_ROOT="/app/data/wine" # --- tpbig.exe (Legacy ATP path: wine_allowed_root/ATP/tpbig.exe) --- if [ -f "${STATIC_ROOT}/ATP/tpbig.exe" ]; then mkdir -p "${DATA_ROOT}/ATP" if [ ! -f "${DATA_ROOT}/ATP/tpbig.exe" ] || ! cmp -s "${STATIC_ROOT}/ATP/tpbig.exe" "${DATA_ROOT}/ATP/tpbig.exe"; then cp "${STATIC_ROOT}/ATP/tpbig.exe" "${DATA_ROOT}/ATP/tpbig.exe" echo "entrypoint: initialized ${DATA_ROOT}/ATP/tpbig.exe" fi fi # --- tpbig.exe (atp-storage path: used by atp_engine_executable) --- if [ -f "${STATIC_ROOT}/atp/tpbig.exe" ]; then mkdir -p "${DATA_ROOT}/atp" if [ ! -f "${DATA_ROOT}/atp/tpbig.exe" ] || ! cmp -s "${STATIC_ROOT}/atp/tpbig.exe" "${DATA_ROOT}/atp/tpbig.exe"; then cp "${STATIC_ROOT}/atp/tpbig.exe" "${DATA_ROOT}/atp/tpbig.exe" echo "entrypoint: initialized ${DATA_ROOT}/atp/tpbig.exe" fi fi # --- tpbig.exe (atp-models storage: atp_storage_root) --- if [ -f "${STATIC_ROOT}/ATP/tpbig.exe" ]; then mkdir -p "${DATA_ROOT}/atp-models" if [ ! -f "${DATA_ROOT}/atp-models/tpbig.exe" ] || ! cmp -s "${STATIC_ROOT}/ATP/tpbig.exe" "${DATA_ROOT}/atp-models/tpbig.exe"; then cp "${STATIC_ROOT}/ATP/tpbig.exe" "${DATA_ROOT}/atp-models/tpbig.exe" echo "entrypoint: initialized ${DATA_ROOT}/atp-models/tpbig.exe" fi fi # Execute the main container command exec "$@"