Bỏ qua để đến nội dung
ViGrise Platform

Build from Source

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

If you prefer to build PreviewProxy yourself rather than use the Docker image, follow these steps.

DependencyRequired forNotes
Rust (stable)Core buildInstall via rustup
pkg-configLinking system librariesInstall via your system package manager
cmakeJPEG XL build (jpegxl-sys)Install via your system package manager
nasmAVIF encoding (rav1e)Install via your system package manager
libheifHEIC input supportInstall via your system package manager
pdfiumPDF input supportOptional - download from pdfium-binaries
ffmpegVideo thumbnail extractionOptional - must be on PATH or set via PP_FFMPEG_PATH
Terminal window
# Debian/Ubuntu
sudo apt install build-essential pkg-config cmake nasm libheif-dev ffmpeg
# macOS (Homebrew)
brew install pkgconf cmake nasm libheif ffmpeg
# Arch Linux
sudo pacman -S pkgconf cmake nasm libheif ffmpeg

Windows - requires Visual Studio Build Tools and vcpkg. Run in a Developer PowerShell:

Terminal window
choco install pkgconfiglite -y
vcpkg install dav1d libjxl libheif --triplet x64-windows-static-md

Then set these environment variables before building:

Terminal window
$env:VCPKG_ROOT = "C:\vcpkg"
$env:PKG_CONFIG_PATH = "C:\vcpkg\installed\x64-windows-static-md\lib\pkgconfig"

pdfium does not have official package manager distributions. Download the prebuilt binary for your platform from the pdfium-binaries project and place the shared library where the linker can find it.

Terminal window
# Example for Linux x86_64
curl -L https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-x64.tgz | tar xz
sudo cp lib/libpdfium.so /usr/local/lib/
sudo ldconfig
Terminal window
# Example for macOS (Apple Silicon)
curl -L https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-mac-arm64.tgz | tar xz
sudo cp lib/libpdfium.dylib /usr/local/lib/
Terminal window
# Example for Windows x86_64
curl -L https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-win-x64.tgz | tar xz
copy bin\pdfium.dll C:\Windows\System32\

Clone the repository and build in release mode:

Terminal window
git clone https://github.com/ViGrise/previewproxy.git
cd previewproxy
cargo build --release

The compiled binary will be placed at:

./target/release/previewproxy
Terminal window
./target/release/previewproxy serve

PreviewProxy will start and listen on port 8080.

Every configuration option can be provided either as an environment variable or as a CLI flag. Flags take precedence over environment variables.

Environment VariableCLI FlagDescription
PP_PORT--portServer listen port
PP_APP_ENV--envEnvironment (development or production)
PP_HMAC_KEY--hmac-keyHMAC-SHA256 signing key
PP_ALLOWED_HOSTS--allowed-hostsComma-separated allowed upstream hostnames
PP_CACHE_DIR--cache-dirL2 disk cache directory
PP_FFMPEG_PATH--ffmpeg-pathPath to the ffmpeg binary

For the full list of flags, run:

Terminal window
./target/release/previewproxy serve --help