# Multi-stage Dockerfile for rclone
# Builder stage: compile rclone from source using a Go toolchain on Alpine
FROM golang:tip-alpine3.23 AS builder
ARG CGO_ENABLED=0
WORKDIR /go/src/github.com/rclone/rclone/
# Improve build caching for Go
ENV GOCACHE=/root/.cache/go-build
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
# Install build dependencies
RUN echo "**** Install Build Dependencies ****" && \
apk add --no-cache \
make \
bash \
gawk \
git
# Copy go module files and download dependencies first for better cache
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
# Copy the rest of the source tree
COPY . .
# Build the binary using the Makefile (CGO is disabled to produce a static binary)
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
echo "**** Build Binary ****" && \
make
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Final runtime image
FROM alpine:3.22.4
# Install runtime dependencies for rclone
RUN echo "**** Install Runtime Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
# Copy the built binary from builder
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
# Create a dedicated non-root user to run rclone
RUN addgroup -g 1009 rclone && \
adduser -u 1009 -D -S -G rclone rclone
# Run as non-root user
USER rclone
ENTRYPOINT ["rclone"]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
# Ignore git and patch-related files, plus build outputs .git .gitignore vendor node_modules **/node_modules *.pyc *.pyo *.class __pycache__ build dist *.exe *.dll *.so *.dylib *.tar *.gz *.zip *.log *.tmp
Build timed out after 600s
Build timed out after 600s
# Multi-stage Dockerfile for rclone
# Builder stage: compile rclone from source using a Go toolchain on Alpine
FROM golang:tip-alpine3.23 AS builder
ARG CGO_ENABLED=0
# Expose CGO_ENABLED as environment variable for the build
ENV CGO_ENABLED=${CGO_ENABLED}
WORKDIR /go/src/github.com/rclone/rclone/
# Improve build caching for Go
ENV GOCACHE=/root/.cache/go-build
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
# Install build dependencies
RUN echo "**** Install Build Dependencies ****" && \
apk add --no-cache \
make \
bash \
gawk \
git
# Copy go module files and download dependencies first for better cache
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
# Copy the rest of the source tree
COPY . .
# Build the binary using the Makefile (CGO is disabled to produce a static binary)
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
echo "**** Build Binary ****" && \
make
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Final runtime image
FROM alpine:3.22.4
# Install runtime dependencies for rclone
RUN echo "**** Install Runtime Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
# Copy the built binary from builder
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
# Create a dedicated non-root user to run rclone
RUN addgroup -g 1009 rclone && \
adduser -u 1009 -D -S -G rclone rclone
# Run as non-root user
USER rclone
ENTRYPOINT ["rclone"]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
Build timed out after 600s
# Multi-stage Dockerfile for rclone
# Builder stage: compile rclone from source using a Go toolchain on Alpine
FROM golang:tip-alpine3.23 AS builder
ARG CGO_ENABLED=0
# Expose CGO_ENABLED as environment variable for the build
ENV CGO_ENABLED=${CGO_ENABLED}
WORKDIR /go/src/github.com/rclone/rclone/
# Improve build caching for Go
ENV GOCACHE=/root/.cache/go-build
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
# Install build dependencies
RUN echo "**** Install Build Dependencies ****" && \
apk add --no-cache \
make \
bash \
gawk \
git
# Copy go module files and download dependencies first for better cache
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
# Copy the rest of the source tree
COPY . .
# Build the binary using the Makefile (CGO is disabled to produce a static binary)
RUN echo "**** Build Binary ****" && \
make
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Final runtime image
FROM alpine:3.22.4
# Install runtime dependencies for rclone
RUN echo "**** Install Runtime Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
# Copy the built binary from builder
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
# Create a dedicated non-root user to run rclone
RUN addgroup -g 1009 rclone && \
adduser -u 1009 -D -S -G rclone rclone
# Run as non-root user
USER rclone
ENTRYPOINT ["rclone"]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
Build timed out after 600s
FROM golang:alpine AS builder
ARG CGO_ENABLED=0
ENV CGO_ENABLED=$CGO_ENABLED
WORKDIR /go/src/github.com/rclone/rclone/
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache make bash gawk git
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
echo "**** Build Binary ****" && \
make
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Begin final image
FROM alpine:latest
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
ENTRYPOINT [ "rclone" ]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
git node_modules vendor **/*.log *.tmp Dockerfile .dockerignore
Build timed out after 600s
FROM golang:1.26.3-alpine3.19 AS builder
ARG CGO_ENABLED=0
ENV CGO_ENABLED=$CGO_ENABLED
WORKDIR /go/src/github.com/rclone/rclone/
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache make bash gawk git
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
COPY . .
RUN echo "**** Build Binary (rclone) ****" && \
make rclone
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Begin final image
FROM alpine:latest
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
ENTRYPOINT [ "rclone" ]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
Image golang:1.26-alpine exists on Docker Hub.
FROM golang:1.26-alpine AS builder
ARG CGO_ENABLED=0
ENV CGO_ENABLED=$CGO_ENABLED
WORKDIR /go/src/github.com/rclone/rclone/
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache make bash gawk git
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
COPY . .
RUN echo "*** Build Binary (rclone) ***" && \
make rclone
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Begin final image
FROM alpine:latest
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
ENTRYPOINT [ "rclone" ]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
Build timed out after 600s
FROM golang:1.22-alpine3.19 AS builder
ARG CGO_ENABLED=0
ENV CGO_ENABLED=$CGO_ENABLED
WORKDIR /go/src/github.com/rclone/rclone/
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache make bash gawk git
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
COPY . .
RUN echo "*** Build Binary (rclone) ***" && \
make rclone
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Begin final image
FROM alpine:3.22.4
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
ENTRYPOINT [ "rclone" ]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config
Failing step - [builder 7/11] RUN echo "**** Download Go Dependencies ****" && go mod download -x Exact error message and exit code - go: errors parsing go.mod: go.mod:5: unknown directive: godebug - ERROR: failed to build: failed to solve: process "/bin/sh -c echo \"**** Download Go Dependencies ****\" && go mod download -x" did not complete successfully: exit code: 1 Dockerfile context for the failure - Dockerfile:17 (the RUN line invoking go mod download -x) Missing packages or files - No missing packages/files reported. The issue is a syntax/directive error in go.mod (unknown directive: godebug). Version/mismatch information - Stage definitions show: - Stage-1 base: alpine:3.22.4 - Builder base: golang:1.22-alpine3.19 - The error occurs during the Go dependency download step in the builder stage, due to an invalid directive in go.mod on line 5.
- Module: github.com/rclone/rclone - Go: 1.25.0 - Godebug: x509negativeserial=1 Direct dependencies (first require block; representative samples): - bazil.org/fuse v0.0.0-20230120002735-62a210ff1fd5 - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4 - github.com/Azure/go-ntlmssp v0.1.1 - github.com/FilenCloudDienste/filen-sdk-go v0.0.39 - github.com/Files-com/files-sdk-go/v3 v3.3.82 - github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd - github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 - github.com/a8m/tree v0.0.0-20240104212747-2c8764a5f17e - github.com/aalpar/deheap v1.1.2 - ... (and many more; the block lists extensive dependencies) Indirect dependencies (second and third require blocks): - cloud.google.com/go/auth v0.20.0 (indirect) - cloud.google.com/go/auth/oauth2adapt v0.2.8 (indirect) - cloud.google.com/go/compute/metadata v0.9.0 (indirect) - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 (indirect) - github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 (indirect) - github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf (indirect) - ... (and many more; the blocks mark // indirect for numerous transitive deps) Additional block (third/other set): - github.com/IBM/go-sdk-core/v5 v5.21.2 - github.com/Microsoft/go-winio v0.6.2 (indirect) - github.com/ProtonMail/go-crypto v1.4.1 - github.com/golang-jwt/jwt/v4 v4.5.2 - github.com/pkg/xattr v0.4.12 - github.com/pquerna/otp v1.5.0 - golang.org/x/mobile v0.0.0-20260312152759-81488f6aeb60 (indirect) - golang.org/x/term v0.42.0 (indirect) Note: The output contains three require blocks with a very large list of direct and indirect dependencies, including major ecosystems (Azure, AWS, Google Cloud, ProtonMail, Storj, MinIO, etc.) and numerous transitive dependencies. No errors are shown; this is a go.mod-style listing of module dependencies. For the full, exact package/version list, refer to the complete go.mod.
Module: github.com/rclone/rclone Go: 1.25.0 Godebug: x509negativeserial=1 Require (top-level highlights): - bazil.org/fuse v0.0.0-20230120002735-62a210ff1fd5 - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4 - github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4 - github.com/Azure/go-ntlmssp v0.1.1 - github.com/FilenCloudDienste/filen-sdk-go v0.0.39 - github.com/Files-com/files-sdk-go/v3 v3.3.82 - github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd - github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 - github.com/a8m/tree v0.0.0-20240104212747-2c8764a5f17e - github.com/aalpar/deheap v1.1.2 - github.com/abbot/go-http-auth v0.4.0 - github.com/adrg/xdg v0.5.3 - github.com/anacrolix/dms v1.7.2 - github.com/anacrolix/log v0.17.0 - github.com/atotto/clipboard v0.1.4 - github.com/aws/aws-sdk-go-v2 v1.41.5 - github.com/aws/aws-sdk-go-v2/config v1.32.14 - github.com/aws/aws-sdk-go-v2/credentials v1.19.14 - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13 - github.com/aws/aws-sdk-go-v2/service/s3 v1.99.0 - github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 - storj.io/uplink v1.14.0 Require indirect (representative samples): - cloud.google.com/go/auth v0.20.0 - cloud.google.com/go/auth/oauth2adapt v0.2.8 - cloud.google.com/go/compute/metadata v0.9.0 - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 - github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf - github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e - github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f - github.com/ProtonMail/go-srp v0.0.7 - github.com/ProtonMail/gopenpgp/v2 v2.9.0 - github.com/PuerkitoBio/goquery v1.11.0 - github.com/STARRY-S/zip v0.2.3 - github.com/akavel/rsrc v0.10.2 - github.com/anacrolix/generics v0.2.0 - github.com/anchore/go-lzo v0.1.0 - github.com/andybalholm/brotli v1.2.0 - github.com/andybalholm/cascadia v1.3.3 - github.com/appscode/go-querystring v0.0.0-20170504095604-0126cfb3f1dc - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 - github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 - github.com/aws/aws-sdk-go-v2/service/signin v1.0.9 - github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 - github.com/bahlo/generic-list-go v0.2.0 - github.com/beorn7/perks v1.0.1 - github.com/bodgit/plumbing v1.3.0 - github.com/bodgit/sevenzip v1.6.1 - github.com/bodgit/windows v1.0.1 - github.com/boombuler/barcode v1.1.0 - github.com/bradenaw/juniper v0.15.3 - github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 - github.com/buger/jsonparser v1.1.2 - github.com/calebcase/tmpfile v1.0.3 - github.com/cespare/xxhash/v2 v2.3.0 - github.com/chilts/sid v0.0.0-20190607042430-660e94789ec9 - github.com/clipperhouse/uax29/v2 v2.7.0 - github.com/cloudflare/circl v1.6.3 - github.com/cloudsoda/sddl v0.0.0-20250224235906-926454e91efc - github.com/cpuguy83/go-md2man/v2 v2.0.7 - github.com/creasty/defaults v1.8.0 - github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488 - github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc - github.com/dromara/dongle v1.0.1 - github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 - github.com/dustin/go-humanize v1.0.1 - github.com/ebitengine/purego v0.10.0 - github.com/emersion/go-message v0.18.2 - github.com/emersion/go-vcard v0.0.0-20241024213814-c9703dde27ff - github.com/felixge/httpsnoop v1.0.4 - github.com/flynn/noise v1.1.0 - github.com/gdamore/encoding v1.0.1 - github.com/geoffgarside/ber v1.2.0 - github.com/go-ini/ini v1.67.0 - github.com/go-logr/logr v1.4.3 - github.com/go-logr/stdr v1.2.2 - github.com/go-ole/go-ole v1.3.0 - github.com/go-openapi/errors v0.22.6 - github.com/go-openapi/strfmt v0.25.0 - github.com/go-playground/locales v0.14.1 - github.com/go-playground/universal-translator v0.18.1 - github.com/go-playground/validator/v10 v10.30.1 - github.com/go-resty/resty/v2 v2.17.2 - github.com/go-viper/mapstructure/v2 v2.5.0 - github.com/gofrs/flock v0.13.0 - github.com/gogo/protobuf v1.3.2 - github.com/google/btree v1.1.3 - github.com/google/s2a-go v0.1.9 - github.com/googleapis/enterprise-certificate-proxy v0.3.14 - github.com/googleapis/gax-go/v2 v2.21.0 - github.com/gorilla/schema v1.4.1 - github.com/hashicorp/errwrap v1.1.0 - github.com/hashicorp/go-cleanhttp v0.5.2 - github.com/hashicorp/go-multierror v1.1.1 - github.com/hashicorp/go-retryablehttp v0.7.8 - github.com/hashicorp/go-uuid v1.0.3 - github.com/hashicorp/golang-lru/v2 v2.0.7 - github.com/inconshreveable/mousetrap v1.1.0 - github.com/jcmturner/aescts/v2 v2.0.0 - github.com/jcmturner/dnsutils/v2 v2.0.0 - github.com/jcmturner/gofork v1.7.6 - github.com/jcmturner/goidentity/v6 v6.0.1 - github.com/jcmturner/rpc/v2 v2.0.3 Notes: - There are three require blocks total, including a large set of indirects in subsequent blocks. - No errors shown in the output.
FROM golang:1.26-alpine AS builder
ARG CGO_ENABLED=0
ENV CGO_ENABLED=$CGO_ENABLED
WORKDIR /go/src/github.com/rclone/rclone/
RUN echo "**** Set Go Environment Variables ****" && \
go env -w GOCACHE=/root/.cache/go-build
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache make bash gawk git
# Remove invalid directive from go.mod if present (compat with older module files)
RUN sed -i '/^godebug/d' go.mod || true
COPY go.mod .
COPY go.sum .
RUN echo "**** Download Go Dependencies ****" && \
go mod download -x
RUN echo "**** Verify Go Dependencies ****" && \
go mod verify
COPY . .
RUN echo "*** Build Binary (rclone) ***" && \
make rclone
RUN echo "**** Print Version Binary ****" && \
./rclone version
# Begin final image
FROM alpine:latest
RUN echo "**** Install Dependencies ****" && \
apk add --no-cache \
ca-certificates \
fuse3 \
tzdata && \
echo "Enable user_allow_other in fuse" && \
echo "user_allow_other" >> /etc/fuse.conf
COPY --from=builder /go/src/github.com/rclone/rclone/rclone /usr/local/bin/
RUN addgroup -g 1009 rclone && adduser -u 1009 -Ds /bin/sh -G rclone rclone
ENTRYPOINT [ "rclone" ]
WORKDIR /data
ENV XDG_CONFIG_HOME=/config