FROM alpine:latest # Install necessary dependencies RUN apk add --no-cache tzdata ca-certificates wget unzip # Set up a working directory WORKDIR /workspace # Download and install Xray Core RUN wget https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip && \ unzip Xray-linux-64.zip && \ rm Xray-linux-64.zip && \ chmod +x xray # Copy the template config and the startup script COPY config.template.json /workspace/config.template.json COPY entrypoint.sh /workspace/entrypoint.sh # Make the startup script executable RUN chmod +x /workspace/entrypoint.sh # Create a non-root user (Hugging Face standard security practice) RUN adduser -D -u 1000 appuser && \ chown -R appuser:appuser /workspace USER 1000 # Expose the mandatory Hugging Face web port EXPOSE 7860 # Run the entrypoint script on startup instead of calling Xray directly CMD ["/workspace/entrypoint.sh"]