mirror of
https://github.com/KevinMidboe/s3-mounter.git
synced 2025-10-28 17:20:38 +00:00
Init commit
This commit is contained in:
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# metadata
|
||||
LABEL org.opencontainers.image.source=https://github.com/kevinmidboe/s3-mounter
|
||||
LABEL org.opencontainers.image.description="Mount s3 (google) bucket to folder using s3fs-fuse"
|
||||
LABEL org.opencontainers.image.licenses=MIT
|
||||
|
||||
ENV MNT_POINT=/var/s3fs
|
||||
ARG S3FS_VERSION=v1.95
|
||||
|
||||
# install, compile and cleanup s3fs-fuse
|
||||
RUN apk --update --no-cache add fuse alpine-sdk automake autoconf libxml2-dev fuse-dev curl-dev git bash; \
|
||||
git clone https://github.com/s3fs-fuse/s3fs-fuse.git; \
|
||||
cd s3fs-fuse; \
|
||||
./autogen.sh; \
|
||||
./configure; \
|
||||
make; \
|
||||
make install; \
|
||||
make clean; \
|
||||
rm -rf /var/cache/apk/*; \
|
||||
apk del git automake autoconf
|
||||
|
||||
# setup mountpoint
|
||||
RUN mkdir -p "$MNT_POINT"
|
||||
WORKDIR "$MNT_POINT"
|
||||
|
||||
# copy startup script
|
||||
COPY startup.sh /app/startup.sh
|
||||
RUN chmod 500 /app/startup.sh
|
||||
|
||||
CMD /app/startup.sh
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Kevin Midbøe
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
22
README.md
Normal file
22
README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# s3fs mounter
|
||||
|
||||
Image for mounting s3 (google) bucket to filesystem.
|
||||
|
||||
## build
|
||||
|
||||
Build docker image.
|
||||
|
||||
```bash
|
||||
docker build -t s3fs-mounter .
|
||||
```
|
||||
|
||||
## run
|
||||
|
||||
Run docker image. Need to run with privileged flag.
|
||||
|
||||
```bash
|
||||
export S3_BUCKET=BUCKET_NAME
|
||||
export HMAC_KEY=ACCESS_KEY:SECRET
|
||||
|
||||
docker run --rm --privileged -e S3_BUCKET -e HMAC_KEY --name s3fs-mounter s3fs-mounter
|
||||
```
|
||||
17
startup.sh
Normal file
17
startup.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "$HMAC_KEY" > /etc/gcs-auth && chmod 600 /etc/gcs-auth
|
||||
s3fs -d -d "$S3_BUCKET" "$MNT_POINT" \
|
||||
-o use_cache=/tmp \
|
||||
-o passwd_file=/etc/gcs-auth \
|
||||
-o url=https://storage.googleapis.com \
|
||||
-o sigv2 \
|
||||
-o nomultipart \
|
||||
-o cipher_suites=AESGCM \
|
||||
-o stat_cache_expire=20,use_cache=1,max_stat_cache_size=60000 \
|
||||
-o max_background=1000 \
|
||||
-o max_stat_cache_size=100000 \
|
||||
-o multipart_size=52 \
|
||||
-o parallel_count=30 \
|
||||
-o multireq_max=30 \
|
||||
-o dbglevel=warn && tail -f /dev/null
|
||||
Reference in New Issue
Block a user