Filetray

pipeline status coverage report

Build a dead-simple mini-site to facilitate file distribution and download.

Installation

Install prerequisites:

sudo apt install php-cli php-phar php-yaml

Download the script and make it executable:

curl https://filetray.pages.cylab.be/filetray.phar -o filetray.phar
chmod +x filetray.phar

Optionnally, add filetray to your PATH:

mv filetray.phar ~/.local/bin/

Usage

Create one or more publish.yml files describing what should be published, and where in the directory structure. For example:

$ cat publish.yml 
- pattern: "README.md"
  target: "/"
- pattern: "filetray.phar"
  target: "/"
- patterh: "*.pdf"
  target: "/references"

The publish.yml file(s) can be located at the root of the project, or in any sub-directory.

Build the mini-site:

$ filetray.phar --source . --target ./target

Run the mini-site:

$ cd target
$ docker compose up --build

After a few seconds, your mini-site will be available at http://127.0.0.1:8080

Filetray

GitLab integration

Typically, filetray can be integrated in a .gitlab-ci.yaml pipeline:

stages:
  - build
  - filetray
  - docker

build:
  stage: build
  script:
    - # build your artifacts like PDF and stuff
  artifacts:
    paths:
      - the-artifact.pdf

filetray:
  stage: filetray
  image: gitlab.cylab.be:8081/cylab/filetray:latest
  script:
    - filetray --source . --target target
  artifacts:
    paths:
      - target

docker:
  stage: docker
  # this job requires docker-in-docker
  tags:
    - dind
  image: docker:20.10.17
  services:
    - docker:20.10.17-dind
  variables:
    # Specify to Docker where to create the certificates. Docker
    # creates them automatically on boot, and creates
    # `/certs/client` to share between the service and job
    # container, thanks to volume mount from config.toml
    DOCKER_TLS_CERTDIR: "/certs"

  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  script:
    - docker pull $CI_REGISTRY_IMAGE:latest || true
    - cd target && docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
    - docker push $CI_REGISTRY_IMAGE:latest

You can also find a working example in this project .gitlab-ci.yml

Size
Sub 1 items
SubWithoutSlash 1 items
README.md 2.7 kB
favicon.ico 15.04 kB
filetray.pdf 0 B
filetray.phar 318.94 kB
filetray.png 125.53 kB
Generated on 2025-09-02 12:32:01UTC with Filetray - https://gitlab.cylab.be/cylab/filetray