Closed ghost closed 2 years ago
Just FYI, this didn't work for me. Fails in the same way that master does.
docker build --build-arg \
plugins="git,cors,realip,expires,cache,googlecloud" \
github.com/abiosoft/caddy-docker.git#pull/223/head
...
can't load package: package caddy:
cors.go:2:10: invalid import path: ""
error at 'building caddy'
The command '/bin/sh -c VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh' returned a non-zero code: 1
@gabegundy you have to rebuild abiosoft/caddy:builder
first, the builder.sh
is bundled inside it.
Hello, can you make an advice please is there a way to use your pull in DockerFile?
RUN go get -v github.com/abiosoft/parent
As i understand builder.sh is downloading here but how can be downloaded your pull instead?
@jffin just replace builder.sh
in the abiosoft/caddy:builder
, if you are using the default dockerfile in this repo, here is the example:
#
# Builder
#
FROM abiosoft/caddy:builder
# add this line before you run `/bin/sh /usr/bin/builder.sh`
ADD https://raw.githubusercontent.com/jeffreystoke/caddy-docker/master/builder/builder.sh /usr/bin/builder.sh
# ...
#
# Final stage
#
FROM alpine:3.10
# ...
it works thanks a lot
Gets stuck forever here:
starting stage: installing plugin helper
go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
ignoring go.mod;
see 'go help modules'
github.com/abiosoft/caddyplug (download)
github.com/abiosoft/errs (download)
github.com/fatih/color (download)
Fetching https://golang.org/x/sys/unix?go-get=1
Parsing meta tags from https://golang.org/x/sys/unix?go-get=1 (status code 200)
get "golang.org/x/sys/unix": found meta tag get.metaImport{Prefix:"golang.org/x/sys", VCS:"git", RepoRoot:"https://go.googlesource.com/sys"} at https://golang.org/x/sys/unix?go-get=1
get "golang.org/x/sys/unix": verifying non-authoritative meta tag
Fetching https://golang.org/x/sys?go-get=1
Parsing meta tags from https://golang.org/x/sys?go-get=1 (status code 200)
golang.org/x/sys (download)
github.com/abiosoft/errs
github.com/fatih/color/vendor/github.com/mattn/go-isatty
golang.org/x/sys/unix
github.com/abiosoft/caddyplug/internal
github.com/fatih/color/vendor/github.com/mattn/go-colorable
github.com/fatih/color
github.com/abiosoft/caddyplug/caddyplug
finished stage: installing plugin helper ✓
starting stage: fetching dns plugin sources
Cloning into '/dnsproviders'...
finished stage: fetching dns plugin sources ✓
starting stage: generating plugins
@tobiasmuehl that could happen since there is no limit to the retry, can you make sure your plugin is properly annotated with package here: https://github.com/caddyserver/caddy/blob/96579b97f687c95aeb85f09029d48122d84c668e/caddyhttp/httpserver/plugin.go#L626
Note: change the file version to match yours.
@jeffreystoke That explains it, the redis plugin is missing from the list. Using the build service from caddyserver.com for now but would prefer to self-build.
Redis is a clustering plugin so it probably belongs somewhere else, not in directives
.
// directives is the list of all directives known to exist for the
// http server type, including non-standard (3rd-party) directives.
@tobiasmuehl I see that now. Thanks. I reworked the build to be muti-stage (seems cleaner anyway) and it works great. Thanks.
Unfortunately it doesn't seem to work anymore. I just tried it with the Dockerfile snippet and didn't have any luck.
@tobiasmuehl that could happen since there is no limit to the retry, can you make sure your plugin is properly annotated with package here: https://github.com/caddyserver/caddy/blob/96579b97f687c95aeb85f09029d48122d84c668e/caddyhttp/httpserver/plugin.go#L626
Note: change the file version to match yours.
Redis is a clustering plugin so it probably belongs somewhere else, not in
directives
.// directives is the list of all directives known to exist for the // http server type, including non-standard (3rd-party) directives.
Hi,
I am also running into the same issue. Can you please elaborate on the steps that you followed?
Anyone managed to solve? @jeffreystoke 's fix seems not to be working anymore:
docker build --build-arg \
plugins=git \
github.com/jeffreystoke/caddy-docker.git
Got same error:
can't load package: package caddy:
git.go:2:10: invalid import path: ""
error at 'building caddy'
The command '/bin/sh -c VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=${enable_telemetry} /bin/sh /usr/bin/builder.sh' returned a non-zero code: 1
@sparampalli I'm not self building, using the commercial installer provided. Here's my dockerfile:
FROM alpine
RUN apk update && apk add bash curl
RUN curl https://getcaddy.com | bash -s personal redis
ADD Caddyfile /etc/Caddyfile
ENTRYPOINT ["caddy"]
CMD ["--conf", "/etc/Caddyfile", "--agree=true"]
Someone managed to solve this problem. I can't build. I've tried using the script above but it freezes when loading the plugins.
It only works with the "cloudflare" plugin, but I need to include other plugins.
Does anyone find a solution to this error?
@oslah212 i found no way. I solved it bundling the pre-compiled Caddy executable in the docker container. Dirty fix but needed.
hi @Guglio95 . How can I solve it this way? My goal is to use it with some additional plugins.
When I want to use plugin namesilo, i build caddy in this way. Hope it would help.
#
FROM abiosoft/caddy:builder as builder1
ARG version="1.0.3"
ARG plugins="namesilo"
# process wrapper
RUN go get -v github.com/abiosoft/parent
RUN VERSION=${version} PLUGINS=${plugins} ENABLE_TELEMETRY=false /bin/sh /usr/bin/builder.sh
Please note that this issue was created for Caddy 1, not Caddy 2.
@oslah212 you should get the Caddy v1 binary, or compile it by yourself if you need additional plugins. Then you should create a docker container bundling in it the compiled executable. This is a bad trick, but I needed to get it working; then I migrated to Caddy v2 :smile:
FROM alpine:3.10
ADD caddy /usr/bin/caddy
COPY Caddyfile /etc/Caddyfile
VOLUME /root/.caddy
VOLUME /var/log
ENTRYPOINT ["/bin/sh"]
CMD ["/usr/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout", "--agree=false"]
This pull request tries to fix
invalid import path: ""
(related issues: #222 #220 )I've noticed this behavior recently in my build pipline and tried
caddyplug package
alone: it fails for the first one or two times and works all the following try.I've checked the source code, but found nothing could result this behavior, so I decide to make this temporary fix, hope this will work for everyone else.