Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: serve s3 as a proxy server #8

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
bin
contrib
rclone
graphics
42 changes: 33 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
FROM golang:alpine AS builder

COPY . /go/src/github.com/rclone/rclone/
WORKDIR /go/src/github.com/rclone/rclone/
WORKDIR /rclone/
COPY go.mod /rclone/
RUN go mod download

COPY . /rclone/

RUN apk add --no-cache make bash gawk git
RUN \
CGO_ENABLED=0 \
make
RUN ./rclone version
make && \
./rclone version


# Begin final image
FROM alpine:latest

RUN apk --no-cache add ca-certificates fuse3 tzdata && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /rclone/rclone /usr/local/bin/

COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
COPY ["./docker/startup", "/startup"]

RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
RUN apk --no-cache add \
ca-certificates \
fuse3 \
tzdata \
&& apk cache clean

ENTRYPOINT [ "rclone" ]
RUN echo "user_allow_other" >> /etc/fuse.conf && \
addgroup -g 1009 rclone && \
adduser -u 1009 -Ds /bin/sh -G rclone rclone && \
chmod +x /startup

WORKDIR /data

ENV XDG_CONFIG_HOME=/config

# remote configs
ENV REMOTE_NAME=""
ENV REMOTE_URL=""
ENV REMOTE_VENDOR=""

# s3 proxy configs
# a space separated list of options
ENV PROXY_ARGS=""

ENTRYPOINT [ "/startup" ]

EXPOSE 8080
300 changes: 149 additions & 151 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions backend/webdav/webdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
if opt.User != "" || opt.Pass != "" {
f.srv.SetUserPass(opt.User, opt.Pass)
} else if opt.BearerToken != "" {
f.setBearerToken(opt.BearerToken)
f.SetBearerToken(opt.BearerToken)
} else if f.opt.BearerTokenCommand != "" {
err = f.fetchAndSetBearerToken()
if err != nil {
Expand Down Expand Up @@ -512,7 +512,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
}

// sets the BearerToken up
func (f *Fs) setBearerToken(token string) {
func (f *Fs) SetBearerToken(token string) {
f.opt.BearerToken = token
f.srv.SetHeader("Authorization", "Bearer "+token)
}
Expand Down Expand Up @@ -570,7 +570,7 @@ func (f *Fs) fetchAndSetBearerToken() error {
if err != nil {
return err
}
f.setBearerToken(token)
f.SetBearerToken(token)
return nil
}

Expand Down
Loading