#!/bin/sh # Use English for comments to avoid encoding issues. set -e # In Hugging Face Spaces, the /data directory is a persistent, writable volume. # The go-drive application expects its data to be in /app/data. # The base image creates /app/data as a normal directory. # To persist data, we need to replace /app/data with a symbolic link # to /data. # This needs to be done at container startup, not during the image build, # because /data is a runtime mount. # If /app/data exists and is not a symbolic link, remove it. # Then create the symbolic link. if [ ! -L /app/data ]; then echo "/app/data is not a symlink. Replacing with a symlink to /data" rm -rf /app/data ln -s /data /app/data fi # The application requires a 'temp' directory inside the data root. # We ensure it exists. mkdir -p /app/data/temp echo "Starting go-drive..." # Execute the command passed as arguments to this script (the Docker CMD). exec "$@"