├── .env.example ├── .github ├── renovate.json5 └── workflows │ ├── run-checks.yml │ ├── update-dependencies.yml │ └── update-package.yml ├── .gitignore ├── Containerfile ├── LICENSE ├── Makefile ├── README.md ├── docs ├── examples │ └── compose.yml └── make.md ├── rootfs ├── entrypoint.sh ├── etc │ ├── exports.d │ │ └── root.exports │ └── s6-overlay │ │ └── s6-rc.d │ │ ├── nfs-configure │ │ ├── dependencies.d │ │ │ └── rclone │ │ ├── type │ │ └── up │ │ ├── nfs-serve │ │ ├── dependencies.d │ │ │ └── nfs-configure │ │ ├── run │ │ └── type │ │ ├── nfs │ │ ├── contents.d │ │ │ ├── nfs-configure │ │ │ └── nfs-serve │ │ └── type │ │ ├── rclone-configure │ │ ├── type │ │ └── up │ │ ├── rclone-mount │ │ ├── dependencies.d │ │ │ └── rclone-serve │ │ ├── type │ │ └── up │ │ ├── rclone-refresh │ │ ├── dependencies.d │ │ │ └── rclone-mount │ │ ├── run │ │ └── type │ │ ├── rclone-serve │ │ ├── dependencies.d │ │ │ └── rclone-configure │ │ ├── run │ │ └── type │ │ ├── rclone │ │ ├── contents.d │ │ │ ├── rclone-configure │ │ │ ├── rclone-mount │ │ │ ├── rclone-refresh │ │ │ └── rclone-serve │ │ └── type │ │ └── user │ │ ├── contents.d │ │ ├── nfs │ │ └── rclone │ │ └── type └── usr │ └── sbin │ └── s6-stage2-hook └── tests ├── index.sh ├── it_should_mount_an_s3_bucket_as_a_docker_volume.sh └── testcase.sh /.env.example: -------------------------------------------------------------------------------- 1 | S3_ENDPOINT= 2 | S3_REGION= 3 | S3_BUCKET= 4 | S3_ACCESS_KEY_ID= 5 | S3_SECRET_ACCESS_KEY= 6 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | extends: [ 3 | "https://raw.githubusercontent.com/nedix/actions/main/renovate.json5", 4 | ], 5 | customManagers: [ 6 | { 7 | depNameTemplate: "Alpine", 8 | fileMatch: ["^Containerfile$"], 9 | matchStrings: ["ARG ALPINE_VERSION=(?.*?)\\n"], 10 | datasourceTemplate: "docker", 11 | packageNameTemplate: "alpine", 12 | }, 13 | { 14 | depNameTemplate: "Rclone", 15 | fileMatch: ["^Containerfile$"], 16 | matchStrings: ["ARG RCLONE_VERSION=(?.*?)\\n"], 17 | datasourceTemplate: "docker", 18 | packageNameTemplate: "rclone/rclone", 19 | }, 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /.github/workflows/run-checks.yml: -------------------------------------------------------------------------------- 1 | name: Run checks 2 | 3 | on: 4 | merge_group: 5 | pull_request_target: 6 | branches: ['main'] 7 | types: ['opened', 'reopened', 'synchronize'] 8 | 9 | jobs: 10 | run-checks: 11 | name: Run checks 12 | runs-on: ubuntu-latest 13 | steps: 14 | - id: run-checks 15 | name: Run checks 16 | uses: nedix/actions/run-checks@main 17 | with: 18 | command: ./tests/index.sh 19 | -------------------------------------------------------------------------------- /.github/workflows/update-dependencies.yml: -------------------------------------------------------------------------------- 1 | name: Update dependencies 2 | 3 | on: 4 | merge_group: 5 | pull_request_target: 6 | branches: ['main'] 7 | paths-ignore: ['.github/**/*'] 8 | types: ['closed'] 9 | schedule: 10 | - cron: '0 */6 * * *' 11 | workflow_dispatch: 12 | 13 | jobs: 14 | update-dependencies: 15 | name: Update dependencies 16 | runs-on: ubuntu-latest 17 | steps: 18 | - id: update-dependencies 19 | name: Update dependencies 20 | uses: nedix/actions/update-dependencies@main 21 | with: 22 | app_id: ${{ secrets.GH_APP_ID }} 23 | app_pem: ${{ secrets.GH_APP_PEM }} 24 | personal_access_token: ${{ secrets.GH_PAT }} 25 | -------------------------------------------------------------------------------- /.github/workflows/update-package.yml: -------------------------------------------------------------------------------- 1 | name: Update package 2 | 3 | on: 4 | push: 5 | tags: ['*'] 6 | 7 | permissions: 8 | attestations: write 9 | id-token: write 10 | packages: write 11 | security-events: write 12 | 13 | jobs: 14 | update-package: 15 | name: Update package 16 | runs-on: ubuntu-latest 17 | steps: 18 | - id: update-package 19 | name: Update package 20 | uses: nedix/actions/update-package@main 21 | with: 22 | platforms: linux/amd64,linux/arm64/v8 23 | registry: ${{ secrets.REGISTRY_DOMAIN }} 24 | registry_path: ${{ secrets.REGISTRY_PATH }} 25 | registry_username: ${{ secrets.REGISTRY_USERNAME }} 26 | registry_password: ${{ secrets.REGISTRY_PASSWORD }} 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | -------------------------------------------------------------------------------- /Containerfile: -------------------------------------------------------------------------------- 1 | ARG ALPINE_VERSION=3.22 2 | ARG RCLONE_VERSION=1.69.3 3 | ARG RCLONE_WEBUI_VERSION=2.0.5 4 | ARG S6_OVERLAY_VERSION=3.2.0.0 5 | ARG STARTUP_TIMEOUT=30 6 | 7 | FROM alpine:${ALPINE_VERSION} AS base 8 | 9 | ARG S6_OVERLAY_VERSION 10 | 11 | RUN apk add --virtual .build-deps \ 12 | xz \ 13 | && case "$(uname -m)" in \ 14 | aarch64|arm*) \ 15 | CPU_ARCHITECTURE="aarch64" \ 16 | ;; x86_64) \ 17 | CPU_ARCHITECTURE="x86_64" \ 18 | ;; *) echo "Unsupported architecture: $(uname -m)"; exit 1; ;; \ 19 | esac \ 20 | && wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \ 21 | | tar -xpJf- -C / \ 22 | && wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${CPU_ARCHITECTURE}.tar.xz" \ 23 | | tar -xpJf- -C / \ 24 | && apk del .build-deps 25 | 26 | FROM rclone/rclone:${RCLONE_VERSION} AS rclone 27 | 28 | FROM base AS rclone-webui 29 | 30 | ARG RCLONE_WEBUI_VERSION 31 | 32 | WORKDIR /build/rclone-webui 33 | 34 | RUN wget -qO- "https://github.com/rclone/rclone-webui-react/releases/download/v${RCLONE_WEBUI_VERSION}/currentbuild.zip" \ 35 | | unzip - \ 36 | && mkdir -p /var/rclone/webgui \ 37 | && mv -T build /var/rclone/webgui 38 | 39 | FROM base 40 | 41 | RUN apk add \ 42 | fuse3 \ 43 | nfs-utils 44 | 45 | COPY --link --from=rclone /usr/local/bin/rclone /usr/bin/ 46 | COPY --link --from=rclone-webui /var/rclone/webgui/ /var/rclone/webgui/ 47 | 48 | COPY /rootfs/ / 49 | 50 | ARG STARTUP_TIMEOUT 51 | ENV STARTUP_TIMEOUT="$STARTUP_TIMEOUT" 52 | 53 | ENTRYPOINT ["/entrypoint.sh"] 54 | 55 | # NFS 56 | EXPOSE 2049 57 | 58 | # Rclone 59 | EXPOSE 5572/tcp 60 | 61 | VOLUME /var/rclone 62 | 63 | HEALTHCHECK \ 64 | --start-period=15s \ 65 | CMD nc -z 127.0.0.1 2049 66 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 NEDIX 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | setup: 2 | @test -e .env || cp .env.example .env 3 | @docker build --progress=plain -f Containerfile -t s3-nfs . 4 | 5 | destroy: 6 | -@docker rm -fv s3-nfs 7 | 8 | up: NFS_PORT = "2049" 9 | up: 10 | @docker run --rm -d --name s3-nfs \ 11 | --cap-add SYS_ADMIN \ 12 | --device /dev/fuse \ 13 | --env-file .env \ 14 | -p 127.0.0.1:$(NFS_PORT):2049 \ 15 | s3-nfs 16 | @docker logs -f s3-nfs 17 | 18 | down: 19 | -@docker stop s3-nfs 20 | 21 | shell: 22 | @docker exec -it s3-nfs /bin/sh 23 | 24 | test: 25 | @$(CURDIR)/tests/index.sh 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [s3-nfs-container][project] 2 | 3 | Mount an S3 bucket as an NFS filesystem so it can be used as a Docker or Docker Compose volume. 4 | 5 | 6 | ## Usage as a Compose volume 7 | 8 | The example Compose manifest will start the s3-nfs container on localhost port `2049`. 9 | It will then make the NFS filesystem available to other services by configuring it as a volume. 10 | The `service_healthy` condition ensures that a connection to the bucket is successfully established before the other services will start using it. 11 | Multiple services can use the same volume. 12 | 13 | 14 | ### 1. Create the Compose manifest 15 | 16 | ```shell 17 | wget -q https://raw.githubusercontent.com/nedix/s3-nfs-container/main/docs/examples/compose.yml 18 | ``` 19 | 20 | 21 | ### 2. Start the container 22 | 23 | ```shell 24 | docker compose up -d 25 | ``` 26 | 27 | 28 | ### 3. List the S3 bucket contents from inside the example container 29 | 30 | ```shell 31 | docker compose exec example-container ls /data 32 | ``` 33 | 34 | 35 | ## Usage as a directory mount 36 | 37 | The following example mounts a bucket to a local directory named `s3-nfs`. 38 | 39 | 40 | ### 1. Start the container 41 | 42 | ```shell 43 | docker run --rm --pull always --name s3-nfs \ 44 | --cap-add SYS_ADMIN \ 45 | --device /dev/fuse \ 46 | -p 127.0.0.1:2049:2049 \ 47 | -e S3_ENDPOINT=foo \ 48 | -e S3_REGION=bar \ 49 | -e S3_BUCKET=baz \ 50 | -e S3_ACCESS_KEY_ID=qux \ 51 | -e S3_SECRET_ACCESS_KEY=quux \ 52 | --restart unless-stopped \ 53 | nedix/s3-nfs 54 | ``` 55 | 56 | 57 | ### 2. Create a target directory 58 | 59 | ```shell 60 | mkdir s3-nfs 61 | ``` 62 | 63 | 64 | ### 3. Mount the directory 65 | 66 | ```shell 67 | mount -v -o vers=4 -o port=2049 127.0.0.1:/ ./s3-nfs 68 | ``` 69 | 70 | 71 | [project]: https://hub.docker.com/r/nedix/s3-nfs 72 | -------------------------------------------------------------------------------- /docs/examples/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | s3-nfs: 3 | image: nedix/s3-nfs 4 | privileged: true 5 | devices: 6 | - /dev/fuse:/dev/fuse:rwm 7 | environment: 8 | S3_ENDPOINT: ${S3_ENDPOINT:-foo} 9 | S3_REGION: ${S3_REGION:-bar} 10 | S3_BUCKET: ${S3_BUCKET:-baz} 11 | S3_ACCESS_KEY_ID: ${S3_ACCESS_KEY_ID:-qux} 12 | S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY:-quux} 13 | ports: 14 | - 127.0.0.1:2049:2049 15 | 16 | example-container: 17 | image: busybox 18 | volumes: 19 | - s3-nfs:/data 20 | depends_on: 21 | s3-nfs: 22 | condition: service_healthy 23 | 24 | volumes: 25 | s3-nfs: 26 | driver_opts: 27 | type: 'nfs' 28 | o: 'vers=4,addr=127.0.0.1,port=2049,rw' 29 | device: ':/' 30 | -------------------------------------------------------------------------------- /docs/make.md: -------------------------------------------------------------------------------- 1 | # Make 2 | 3 | ## Available commands 4 | 5 | ### Setup 6 | 7 | Build the container. 8 | 9 | Command: `make setup` 10 | 11 | 12 | ### Destroy 13 | 14 | Stop the container and remove volumes. 15 | 16 | Command: `make destroy` 17 | 18 | 19 | ### Up 20 | 21 | Start the container. 22 | 23 | Command: `make up` 24 | 25 | Options: 26 | 27 | | Option key | Default value | 28 | |------------|---------------| 29 | | NFS_PORT | 2049 | 30 | 31 | 32 | ### Down 33 | 34 | Stop the container. 35 | 36 | Command: `make down` 37 | 38 | 39 | ### Shell 40 | 41 | Attach an interactive shell to the container. 42 | 43 | Command: `make shell` 44 | 45 | 46 | ### Test 47 | 48 | Run all tests. 49 | 50 | Command: `make test` 51 | -------------------------------------------------------------------------------- /rootfs/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | : ${BUFFER_SIZE} 4 | : ${CACHE_MAX_AGE} 5 | : ${CACHE_MAX_SIZE} 6 | : ${CACHE_MIN_FREE_SPACE} 7 | : ${CACHE_READ_AHEAD:=0} 8 | : ${CACHE_WRITE_BACK} 9 | : ${DIR_CACHE_TIME:=10} 10 | : ${S3_ACCESS_KEY_ID} 11 | : ${S3_BUCKET} 12 | : ${S3_ENDPOINT} 13 | : ${S3_REGION} 14 | : ${S3_SECRET_ACCESS_KEY} 15 | : ${STARTUP_TIMEOUT} 16 | 17 | HOME_DIRECTORY="/${HOME_DIRECTORY#/}" 18 | HOME_DIRECTORY="${HOME_DIRECTORY%/}" 19 | ROOT_DIRECTORY="/${ROOT_DIRECTORY#/}" 20 | ROOT_DIRECTORY="${ROOT_DIRECTORY%/}" 21 | 22 | # ------------------------------------------------------------------------------- 23 | # Bootstrap rclone services 24 | # ------------------------------------------------------------------------------- 25 | { 26 | # ------------------------------------------------------------------------------- 27 | # Create rclone-configure environment 28 | # ------------------------------------------------------------------------------- 29 | mkdir -p /run/rclone-configure/environment 30 | 31 | echo "$S3_ACCESS_KEY_ID" > /run/rclone-configure/environment/S3_ACCESS_KEY_ID 32 | echo "$S3_BUCKET" > /run/rclone-configure/environment/S3_BUCKET 33 | echo "$S3_ENDPOINT" > /run/rclone-configure/environment/S3_ENDPOINT 34 | echo "$S3_REGION" > /run/rclone-configure/environment/S3_REGION 35 | echo "$S3_SECRET_ACCESS_KEY" > /run/rclone-configure/environment/S3_SECRET_ACCESS_KEY 36 | 37 | # ------------------------------------------------------------------------------- 38 | # Create rclone-mount environment 39 | # ------------------------------------------------------------------------------- 40 | mkdir -p /run/rclone-mount/environment 41 | 42 | echo "$BUFFER_SIZE" > /run/rclone-mount/environment/BUFFER_SIZE 43 | echo "$CACHE_MAX_AGE" > /run/rclone-mount/environment/CACHE_MAX_AGE 44 | echo "$CACHE_MAX_SIZE" > /run/rclone-mount/environment/CACHE_MAX_SIZE 45 | echo "$CACHE_MIN_FREE_SPACE" > /run/rclone-mount/environment/CACHE_MIN_FREE_SPACE 46 | echo "$CACHE_READ_AHEAD" > /run/rclone-mount/environment/CACHE_READ_AHEAD 47 | echo "$CACHE_WRITE_BACK" > /run/rclone-mount/environment/CACHE_WRITE_BACK 48 | echo "$S3_BUCKET" > /run/rclone-mount/environment/S3_BUCKET 49 | 50 | # ------------------------------------------------------------------------------- 51 | # Create rclone-refresh environment 52 | # ------------------------------------------------------------------------------- 53 | mkdir -p /run/rclone-refresh/environment 54 | 55 | echo "$DIR_CACHE_TIME" > /run/rclone-refresh/environment/DIR_CACHE_TIME 56 | } 57 | 58 | # ------------------------------------------------------------------------------- 59 | # Liftoff! 60 | # ------------------------------------------------------------------------------- 61 | exec env -i \ 62 | S6_CMD_WAIT_FOR_SERVICES_MAXTIME="$(( $STARTUP_TIMEOUT * 1000 ))" \ 63 | S6_STAGE2_HOOK=/usr/sbin/s6-stage2-hook \ 64 | /init 65 | -------------------------------------------------------------------------------- /rootfs/etc/exports.d/root.exports: -------------------------------------------------------------------------------- 1 | /mnt/rclone *(rw,fsid=0,no_auth_nlm,insecure,no_subtree_check) 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-configure/dependencies.d/rclone: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/nfs-configure/dependencies.d/rclone -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-configure/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-configure/up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | exportfs -r 4 | 5 | rpc.nfsd -N 3 6 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-serve/dependencies.d/nfs-configure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/nfs-serve/dependencies.d/nfs-configure -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-serve/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | setsid rpc.mountd -F -N 2 -N 3 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs-serve/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs/contents.d/nfs-configure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/nfs/contents.d/nfs-configure -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs/contents.d/nfs-serve: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/nfs/contents.d/nfs-serve -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/nfs/type: -------------------------------------------------------------------------------- 1 | bundle 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-configure/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-configure/up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | : ${S3_ACCESS_KEY_ID} 4 | : ${S3_BUCKET} 5 | : ${S3_ENDPOINT} 6 | : ${S3_REGION} 7 | : ${S3_SECRET_ACCESS_KEY} 8 | 9 | echo "user_allow_other" >> /etc/fuse.conf 10 | 11 | mkdir -p \ 12 | /etc/rclone \ 13 | /mnt/rclone 14 | 15 | cat << EOF >> /etc/rclone/rclone.conf 16 | [remote] 17 | type = s3 18 | provider = Other 19 | access_key_id = ${S3_ACCESS_KEY_ID} 20 | endpoint = ${S3_ENDPOINT} 21 | region = ${S3_REGION} 22 | secret_access_key = ${S3_SECRET_ACCESS_KEY} 23 | EOF 24 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-mount/dependencies.d/rclone-serve: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone-mount/dependencies.d/rclone-serve -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-mount/type: -------------------------------------------------------------------------------- 1 | oneshot 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-mount/up: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | : ${BUFFER_SIZE} 4 | : ${CACHE_MAX_AGE} 5 | : ${CACHE_MAX_SIZE} 6 | : ${CACHE_MIN_FREE_SPACE} 7 | : ${CACHE_READ_AHEAD} 8 | : ${CACHE_WRITE_BACK} 9 | : ${CHECK_FIRST} 10 | : ${ORDER_BY} 11 | : ${S3_BUCKET} 12 | 13 | s6-sleep 1 14 | 15 | main_options() { 16 | cat < /dev/null 9 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-refresh/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-serve/dependencies.d/rclone-configure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone-serve/dependencies.d/rclone-configure -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-serve/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | setsid /usr/bin/rclone rcd \ 4 | --config=/etc/rclone/rclone.conf \ 5 | --rc-addr=:5572 \ 6 | --rc-allow-origin="*" \ 7 | --rc-files=/var/rclone/webgui \ 8 | --rc-no-auth \ 9 | --rc-web-gui-no-open-browser 10 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone-serve/type: -------------------------------------------------------------------------------- 1 | longrun 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-configure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-configure -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-mount: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-mount -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-refresh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-refresh -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-serve: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/rclone/contents.d/rclone-serve -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/rclone/type: -------------------------------------------------------------------------------- 1 | bundle 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/nfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/nfs -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/rclone: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nedix/s3-nfs-container/83be9d9827d3ef7663a628685610c727958d7dd8/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/rclone -------------------------------------------------------------------------------- /rootfs/etc/s6-overlay/s6-rc.d/user/type: -------------------------------------------------------------------------------- 1 | bundle 2 | -------------------------------------------------------------------------------- /rootfs/usr/sbin/s6-stage2-hook: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | CONTAINER_ENVIRONMENT_DIRECTORY=/run/s6/container_environment 6 | SCRIPTS_DIRECTORY=/etc/s6-overlay/scripts 7 | SERVICES_DIRECTORY=/etc/s6-overlay/s6-rc.d 8 | 9 | mkdir "$SCRIPTS_DIRECTORY" 10 | 11 | for SERVICE_PATH in $( \ 12 | find "$SERVICES_DIRECTORY" -mindepth 2 -maxdepth 2 -type f \ 13 | \( -name up -o -name down -o -name run -o -name finish \) \ 14 | ); do 15 | ENVIRONMENT_DIRECTORY=$(echo "$SERVICE_PATH" | sed -E "s|^${SERVICES_DIRECTORY}/([^/]+)/([^/]+)|/run/\1/environment|") 16 | SCRIPT_PATH=$(echo "$SERVICE_PATH" | sed -E "s|^${SERVICES_DIRECTORY}/([^/]+)/([^/]+)|${SCRIPTS_DIRECTORY}/\1/\2|") 17 | 18 | # Symlink container environment to service environment 19 | mkdir -p "$ENVIRONMENT_DIRECTORY" 20 | find "$CONTAINER_ENVIRONMENT_DIRECTORY" -mindepth 1 -maxdepth 1 -type f -exec ln -fs {} "$ENVIRONMENT_DIRECTORY" \; 21 | chmod -R 400 "$ENVIRONMENT_DIRECTORY" 22 | 23 | # Move shell script 24 | mkdir -p "${SCRIPT_PATH%/*}" 25 | mv "$SERVICE_PATH" "$SCRIPT_PATH" 26 | chmod 500 "$SCRIPT_PATH" 27 | 28 | # Create execline script 29 | printf "#!/command/execlineb -P\nexec s6-envdir ${ENVIRONMENT_DIRECTORY} ${SCRIPT_PATH}" > "$SERVICE_PATH" 30 | chmod 400 "$SERVICE_PATH" 31 | done 32 | -------------------------------------------------------------------------------- /tests/index.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | docker build -f Containerfile -t test . 4 | 5 | # TODO 6 | -------------------------------------------------------------------------------- /tests/it_should_mount_an_s3_bucket_as_a_docker_volume.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # TODO 4 | -------------------------------------------------------------------------------- /tests/testcase.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # TODO 4 | --------------------------------------------------------------------------------