Spaces:
Sleeping
Sleeping
Merge pull request #18 from capstone-if-26/dev
Browse filesFiles changed (2)
- Dockerfile+58-1
- entrypoint.sh+41-6
12345COPY docker/entrypoint.sh /entrypoint.shRUN chmod +x /entrypoint.shENTRYPOINT ["/entrypoint.sh"]1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162FROM php:8.4-cliRUN apt-get update && apt-get install -y \git \unzip \curl \zip \ca-certificates \gnupg \libzip-dev \libpng-dev \libjpeg-dev \libfreetype6-dev \libonig-dev \libxml2-dev \libsqlite3-dev \&& docker-php-ext-install \zip \pdo \pdo_mysql \pdo_sqlite \mbstring \exif \pcntl \bcmath \gd \&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \&& apt-get install -y nodejs \&& rm -rf /var/lib/apt/lists/*COPY --from=composer:2 /usr/bin/composer /usr/bin/composerRUN useradd -m -u 1000 userENV HOME=/home/userENV PORT=7860RUN mkdir -p /home/user/app && chown user:user /home/user/appWORKDIR /home/user/appCOPY --chown=user:user . .COPY --chown=user:user entrypoint.sh /entrypoint.shRUN chmod +x /entrypoint.shUSER userRUN composer install \--no-dev \--optimize-autoloader \--no-interaction \--no-scripts \&& php artisan package:discover --ansi \&& npm ci \&& npm run build \&& rm -rf node_modulesEXPOSE 7860ENTRYPOINT ["/entrypoint.sh"]
6 unmodified lines78910111213141516178 unmodified lines26272829303111 unmodified lines43444546474849502 unmodified lines535455565758596061626364656 unmodified linesFILE_VAR="${VAR_NAME}_FILE"FILE_PATH=$(printenv "$FILE_VAR" 2>/dev/null || true)if [ -n "$FILE_PATH" ] && [ -f "$FILE_PATH" ]; thenexport "$VAR_NAME=$(cat "$FILE_PATH")"elif [ -z "$(printenv "$VAR_NAME" 2>/dev/null)" ] && [ -n "$DEFAULT_VALUE" ]; thenexport "$VAR_NAME=$DEFAULT_VALUE"fi}8 unmodified linesload_secret APP_URL "http://localhost"load_secret APP_KEY ""# ==================================================# DATABASE# ==================================================11 unmodified linesload_secret RAG_API_BASE_URL ""load_secret VITE_RAG_API_BASE_URL ""# HuggingFace compatibilityif [ -n "$SPACE_HOST" ] && [ "$APP_URL" = "http://localhost" ]; thenexport APP_URL="https://$SPACE_HOST"fi2 unmodified linesexport ASSET_URL="https://$SPACE_HOST"fi# Generate APP_KEY if missingif [ -z "$APP_KEY" ]; thenexport APP_KEY=$(php artisan key:generate --show --no-interaction)fiphp artisan config:clearexec php artisan serve \--host=0.0.0.0 \--port=${PORT:-7860}6 unmodified lines78910111213141516171819208 unmodified lines29303132333435363738394041424344454647484911 unmodified lines6162636465666768697071722 unmodified lines757677787980818283848586878889909192939495969798991006 unmodified linesFILE_VAR="${VAR_NAME}_FILE"eval FILE_PATH="\${$FILE_VAR}"eval CURRENT_VALUE="\${$VAR_NAME}"if [ -n "$FILE_PATH" ] && [ -f "$FILE_PATH" ]; thenexport "$VAR_NAME=$(tr -d '\r\n' < "$FILE_PATH")"elif [ -n "$CURRENT_VALUE" ]; then:elif [ -n "$DEFAULT_VALUE" ]; thenexport "$VAR_NAME=$DEFAULT_VALUE"fi}8 unmodified linesload_secret APP_URL "http://localhost"load_secret APP_KEY ""# ==================================================# LOGGING# ==================================================load_secret LOG_CHANNEL "stderr"load_secret LOG_LEVEL "debug"# ==================================================# SESSION / CACHE / QUEUE# ==================================================load_secret SESSION_DRIVER "file"load_secret CACHE_STORE "file"load_secret QUEUE_CONNECTION "sync"# ==================================================# DATABASE# ==================================================11 unmodified linesload_secret RAG_API_BASE_URL ""load_secret VITE_RAG_API_BASE_URL ""load_secret VITE_APP_NAME "$APP_NAME"# ==================================================# HUGGINGFACE SPACES# ==================================================if [ -n "$SPACE_HOST" ] && [ "$APP_URL" = "http://localhost" ]; thenexport APP_URL="https://$SPACE_HOST"fi2 unmodified linesexport ASSET_URL="https://$SPACE_HOST"fi# ==================================================# LARAVEL APP KEY# ==================================================if [ -z "$APP_KEY" ]; thenexport APP_KEY=$(php artisan key:generate --show --no-interaction)fi# ==================================================# CACHE CLEAR# ==================================================php artisan config:clearphp artisan route:clearphp artisan view:clear# ==================================================# START SERVER# ==================================================exec php artisan serve \--host=0.0.0.0 \--port="${PORT:-7860}"
Dockerfile+58-1
entrypoint.sh+41-6