Build caddy with plugins via multi-stage (#121)
* build caddy with plugins via multi-stage * drone sig Signed-off-by: Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com>
This commit is contained in:
Родитель
2f163547ea
Коммит
a2e976bb85
|
@ -13,6 +13,7 @@ pipeline:
|
|||
|
||||
docker:
|
||||
image: plugins/docker
|
||||
pull: true
|
||||
repo: gitea/docs
|
||||
tags: [ '${DRONE_BRANCH##release/v}' ]
|
||||
when:
|
||||
|
@ -21,6 +22,7 @@ pipeline:
|
|||
|
||||
docker:
|
||||
image: plugins/docker
|
||||
pull: true
|
||||
repo: gitea/docs
|
||||
tags: [ 'latest' ]
|
||||
when:
|
||||
|
|
|
@ -1 +1 @@
|
|||
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIHBhdGg6IHNyYwoKcGlwZWxpbmU6CiAgYnVpbGQ6CiAgICBpbWFnZTogd2ViaGlwcGllL2h1Z286bGF0ZXN0CiAgICBwdWxsOiB0cnVlCiAgICBjb21tYW5kczoKICAgICAgLSBtYWtlIHRyYW5zLWNvcHkKCiAgICAgIC0gbWFrZSBjbGVhbgogICAgICAtIG1ha2UgYnVpbGQKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICByZXBvOiBnaXRlYS9kb2NzCiAgICB0YWdzOiBbICcke0RST05FX0JSQU5DSCMjcmVsZWFzZS92fScgXQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgcHVzaCBdCiAgICAgIGJyYW5jaDogWyByZWxlYXNlLyogXQoKICBkb2NrZXI6CiAgICBpbWFnZTogcGx1Z2lucy9kb2NrZXIKICAgIHJlcG86IGdpdGVhL2RvY3MKICAgIHRhZ3M6IFsgJ2xhdGVzdCcgXQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgcHVzaCBdCiAgICAgIGJyYW5jaDogWyBtYXN0ZXIgXQoKICBnaXR0ZXI6CiAgICBpbWFnZTogcGx1Z2lucy9naXR0ZXIK.RPW5ozTUJwd47a23CY34doKDRgcm0DitJ-T5qH61Z-Q
|
||||
eyJhbGciOiJIUzI1NiJ9.d29ya3NwYWNlOgogIHBhdGg6IHNyYwoKcGlwZWxpbmU6CiAgYnVpbGQ6CiAgICBpbWFnZTogd2ViaGlwcGllL2h1Z286bGF0ZXN0CiAgICBwdWxsOiB0cnVlCiAgICBjb21tYW5kczoKICAgICAgLSBtYWtlIHRyYW5zLWNvcHkKCiAgICAgIC0gbWFrZSBjbGVhbgogICAgICAtIG1ha2UgYnVpbGQKCiAgZG9ja2VyOgogICAgaW1hZ2U6IHBsdWdpbnMvZG9ja2VyCiAgICBwdWxsOiB0cnVlCiAgICByZXBvOiBnaXRlYS9kb2NzCiAgICB0YWdzOiBbICcke0RST05FX0JSQU5DSCMjcmVsZWFzZS92fScgXQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgcHVzaCBdCiAgICAgIGJyYW5jaDogWyByZWxlYXNlLyogXQoKICBkb2NrZXI6CiAgICBpbWFnZTogcGx1Z2lucy9kb2NrZXIKICAgIHB1bGw6IHRydWUKICAgIHJlcG86IGdpdGVhL2RvY3MKICAgIHRhZ3M6IFsgJ2xhdGVzdCcgXQogICAgd2hlbjoKICAgICAgZXZlbnQ6IFsgcHVzaCBdCiAgICAgIGJyYW5jaDogWyBtYXN0ZXIgXQoKICBnaXR0ZXI6CiAgICBpbWFnZTogcGx1Z2lucy9naXR0ZXIK.-yyNQtRepINu0L0utwOeqe2kg71H4bGMaav5lWOz8-U
|
26
Dockerfile
26
Dockerfile
|
@ -1,16 +1,22 @@
|
|||
# build stage
|
||||
FROM golang:alpine AS build-env
|
||||
|
||||
RUN apk add --no-cache git
|
||||
RUN go get -d -v github.com/mholt/caddy/caddy github.com/pedronasser/caddy-search github.com/simia-tech/caddy-locale
|
||||
WORKDIR /go/src/github.com/mholt/caddy/caddy
|
||||
|
||||
RUN sed -i '/This is where other plugins get plugged in (imported)/a _ "github.com/pedronasser/caddy-search"' caddymain/run.go \
|
||||
&& sed -i '/This is where other plugins get plugged in (imported)/a _ "github.com/simia-tech/caddy-locale"' caddymain/run.go \
|
||||
&& go install -v . \
|
||||
&& /go/bin/caddy -version
|
||||
|
||||
FROM alpine:edge
|
||||
EXPOSE 80
|
||||
|
||||
RUN apk update && \
|
||||
apk add wget mailcap ca-certificates && \
|
||||
rm -rf /var/cache/apk/* && \
|
||||
wget -O /tmp/caddy.tar.gz "https://caddyserver.com/download/build?os=linux&arch=amd64&features=locale%2Csearch" && \
|
||||
mkdir -p /tmp/caddy && \
|
||||
tar xvzf /tmp/caddy.tar.gz -C /tmp/caddy && \
|
||||
cp /tmp/caddy/caddy /usr/sbin/caddy && \
|
||||
rm -rf /tmp/caddy*
|
||||
|
||||
CMD ["/usr/sbin/caddy", "-conf", "/etc/caddy.conf"]
|
||||
RUN apk add --no-cache wget mailcap ca-certificates
|
||||
COPY --from=build-env /go/bin/caddy /usr/sbin/caddy
|
||||
|
||||
COPY docker/caddy.conf /etc/caddy.conf
|
||||
COPY public /srv/www
|
||||
|
||||
CMD ["/usr/sbin/caddy", "-conf", "/etc/caddy.conf"]
|
||||
|
|
Загрузка…
Ссылка в новой задаче