steps:
  - name: build
    image: rust
    commands:
      - apt-get -y update
      - apt-get -y install parallel brotli
      - wget https://github.com/mozilla/sccache/releases/download/v0.7.7/sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz
      - wget https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-x86_64-linux.tar.gz
      - tar -xzf binaryen-version_117-x86_64-linux.tar.gz -C /usr --strip-components=1 
      - tar -xzf sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz
      - mv sccache-v0.7.7-x86_64-unknown-linux-musl/sccache /usr/bin/sccache 
      - chmod +x /usr/bin/sccache
      - sccache --start-server
      - sccache --show-stats
      - curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
      - cargo binstall -y trunk
      - trunk build --release 
      - sh opt.sh
      - rm -rf /var/woodpecker/portfolio
      - mv dist /var/woodpecker/portfolio
    environment:
      - PHOST=https://portfolio.nations.lol/
      - CARGO_BUILD_TARGET_DIR=/var/woodpecker/portfolio-build
    volumes:
      - /var/woodpecker:/var/woodpecker
      - /usr/share/fonts:/usr/share/fonts
