Skip to content

Commit 8ec03df

Browse files
committed
Add paths.yml support
1 parent 65f5856 commit 8ec03df

8 files changed

Lines changed: 1161 additions & 170 deletions

File tree

repo2docker/contentproviders/rdm.py

Lines changed: 0 additions & 156 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# RDM Content Provider
2+
3+
## Overview
4+
5+
This content provider is used to create a Jupyter notebook server from a GakuNin RDM project.
6+
7+
## Configuration
8+
9+
### Folder Mapping Configuration File: `paths.yaml`
10+
11+
When setting up an analysis environment from a GakuNin RDM project, the `paths.yaml` file can be used to specify which files should be copied into the image and which should be symbolically linked. This file explicitly lists file paths and directories and defines whether each path should be copied or symlinked.
12+
13+
The `paths.yaml` file serves a similar purpose to the `fstab` file in Linux, mapping folders in the GakuNin RDM project to appropriate locations within the image. It should be placed in the `.binder` or `binder` directory, and the image builder (`repo2docker`) will prioritize loading from these locations to automatically apply the necessary copy and symlink settings.
14+
15+
The syntax of `paths.yaml` is based on the `volumes` section in Docker Compose file specifications:
16+
https://docs.docker.com/reference/compose-file/volumes/
17+
18+
An example `paths.yaml` is shown below:
19+
20+
```yaml
21+
override: true
22+
paths:
23+
- type: copy
24+
source: $default_storage_path/custom-home-dir
25+
target: .
26+
- type: link
27+
source: /googledrive/subdir
28+
target: ./external/googledrive
29+
```
30+
31+
In the example above, `$default_storage_path/custom-home-dir` is copied to the root directory of the image, and `/googledrive/subdir` is symlinked to `./external/googledrive` within the image.
32+
33+
The `paths.yaml` file is written in YAML format as a dictionary. The top-level dictionary must include the following elements:
34+
35+
* `override`: Set to `true` to disable the default folder mapping (which copies the default storage content to the current directory). If omitted, it is treated as `false`.
36+
* `paths`: A list defining how each file or folder should be handled. Each item is a dictionary specifying the behavior for a specific path.
37+
38+
When `paths.yaml` is present, repo2docker renders the mapping into a `provision.sh` script inside the same `.binder` (or `binder`) directory in the built image. The script contains the `cp` and `ln -s` commands derived from each entry and is executed during container start-up to materialize the requested copy/link layout in the runtime home directory.
39+
40+
#### Elements in the `paths` List
41+
42+
Each item in the `paths` list is a dictionary containing the following keys:
43+
44+
* `type`: Specifies the operation to apply to the folder. Must be either `copy` (copies files from the source) or `link` (creates a symbolic link).
45+
* `source`: The path to the file/folder within the GakuNin RDM project. For example, to specify a folder named `testdir` in a Google Drive storage provider, use `/googledrive/testdir`. The variable `$default_storage_path` can be used to refer to the project’s default storage (note: the default storage is not necessarily `osfstorage`, depending on the institution).
46+
* `target`: Specifies where the file/folder should be placed in the analysis environment. This must be a relative path from the output directory (the home directory when the environment starts). To explicitly indicate a relative path, only paths starting with `.` or `./` are allowed.
47+
48+
> Absolute paths are not allowed for `target`, to prevent the injection of unauthorized executables into the `repo2docker` environment.
49+
50+
If no `paths.yaml` is provided, the default behavior is as follows:
51+
52+
```yaml
53+
paths:
54+
- type: copy
55+
source: $default_storage_path
56+
target: .
57+
```

0 commit comments

Comments
 (0)