Compare commits
131 Commits
Author | SHA1 | Date |
---|---|---|
GitHub Action | 14565441a6 | |
GitHub Action | f6022c46fb | |
GitHub Action | fdfce2a81c | |
GitHub Action | 5768a90b31 | |
Ambrose Chua | f014d96bc1 | |
GitHub Action | 0ef9134a42 | |
GitHub Action | 14d411b907 | |
GitHub Action | 5ed6cc159c | |
GitHub Action | 8b27a83a84 | |
Ambrose Chua | 3ebf3fc291 | |
GitHub Action | 59c1669554 | |
GitHub Action | 16082b038b | |
Ambrose Chua | 9b948a4ba2 | |
Ambrose Chua | 7f50e64c1a | |
Ambrose Chua | c478473e0e | |
Ambrose Chua | 67a4f2d5f8 | |
Ambrose Chua | 8f7d5bf6a4 | |
Ambrose Chua | 1397f67595 | |
Ambrose Chua | 3c9e831f0d | |
GitHub Action | 2d52734b3f | |
GitHub Action | 2669484688 | |
Ambrose Chua | 689ed13540 | |
Ambrose Chua | 56d0d0dc50 | |
Ambrose Chua | 822c883b71 | |
GitHub Action | 557186b6fb | |
GitHub Action | 633a5c0eac | |
Ambrose Chua | c7c3ddf617 | |
GitHub Action | f660d42d6e | |
GitHub Action | d3130c840d | |
GitHub Action | dde82baa17 | |
GitHub Action | f622a3a2d9 | |
GitHub Action | 09d805fb5f | |
GitHub Action | c71bbe4939 | |
Ambrose Chua | f7b2050be3 | |
Ambrose Chua | d43e9fbcbd | |
Ambrose Chua | e8fbdd9f17 | |
Ambrose Chua | 7c6a095c41 | |
Ambrose Chua | 4aac5d2a7a | |
GitHub Action | 94591546dd | |
GitHub Action | 586185dfce | |
GitHub Action | fb83eac642 | |
Ambrose Chua | cae374aaf2 | |
GitHub Action | 07010b57b7 | |
Ambrose Chua | 6a74fac6ff | |
GitHub Action | c0db25d860 | |
GitHub Action | 9a5873f661 | |
GitHub Action | b8d251a249 | |
GitHub Action | d54e90a2ac | |
GitHub Action | e236366905 | |
GitHub Action | aee9a5e6c7 | |
Ambrose Chua | 15135ed66f | |
GitHub Action | 5dc844faa7 | |
GitHub Action | f62dd31263 | |
GitHub Action | 0e93da04f4 | |
GitHub Action | cf5d03865d | |
GitHub Action | 15e4d4bd52 | |
GitHub Action | 4165746846 | |
GitHub Action | 8f0cb4e70f | |
GitHub Action | 87e7c0a928 | |
GitHub Action | 98766a80e5 | |
GitHub Action | a3762b1ce5 | |
Ambrose Chua | c2ac938342 | |
Ambrose Chua | 0117c72e5c | |
Ambrose Chua | 4738a14c42 | |
GitHub Action | aaab8e600b | |
GitHub Action | 27a4557052 | |
Ambrose Chua | 047842607a | |
GitHub Action | 023ea621be | |
GitHub Action | 43ff38498c | |
Ambrose Chua | a9418b602d | |
GitHub Action | bf2e8395bf | |
GitHub Action | f572761455 | |
Ambrose Chua | 46b2bab9fc | |
Ambrose Chua | 706879ff2e | |
GitHub Action | 9c00d3f361 | |
GitHub Action | 8a82abe69d | |
Ambrose Chua | 23390cf95b | |
Ambrose Chua | f4dbe327f8 | |
Ambrose Chua | 43024a740f | |
Ambrose Chua | 089874ef6c | |
GitHub Action | 2504d7391d | |
Ambrose Chua | f65f157230 | |
GitHub Action | 875f158ce2 | |
Ambrose Chua | a7558751f2 | |
Ambrose Chua | 6269d93c31 | |
Ambrose Chua | f8ec8e8d78 | |
Ambrose Chua | 1f2ed024fd | |
Ambrose Chua | 679134731b | |
Ambrose Chua | d1fa52b7b0 | |
serverwentdown | 8d9447f765 | |
serverwentdown | cc3bde2409 | |
serverwentdown | c5550fe7c7 | |
serverwentdown | f1ebc94f8d | |
serverwentdown | 0087b38b91 | |
serverwentdown | 19c57bc1d2 | |
serverwentdown | 65baab83e7 | |
Ambrose Chua | 93d02f84e8 | |
Ambrose Chua | 87fefa0458 | |
serverwentdown | ecadea0524 | |
serverwentdown | 3066abca96 | |
Ambrose Chua | fd25593ddb | |
Ambrose Chua | 0ca103eca0 | |
Ambrose Chua | fe7c86f473 | |
Ambrose Chua | e6854eeefa | |
Ambrose Chua | f86a0e9ee6 | |
serverwentdown | 8a0ff810a3 | |
Ambrose Chua | 3ccd25c006 | |
Ambrose Chua | ba22478c6e | |
serverwentdown | dacf5242f3 | |
Ambrose Chua | ab2a827634 | |
Ambrose Chua | 0998309920 | |
Ambrose Chua | e48ada02f8 | |
Ambrose Chua | 8847460c5e | |
Ambrose Chua | 6cfd270096 | |
Ambrose Chua | 0397eabadc | |
Ambrose Chua | cef2751b69 | |
Ambrose Chua | 326aceeeb7 | |
Ambrose Chua | 3f3df5bfac | |
Ambrose Chua | 66d4e1fca3 | |
Ambrose Chua | a026db8fcf | |
Ambrose Chua | 60a482c943 | |
Ambrose Chua | 2f71859427 | |
Ambrose Chua | 1cac395869 | |
Ambrose Chua | 50220cb01f | |
Ambrose Chua | c50f1ef8cf | |
Ambrose Chua | 8c5b7acbe4 | |
Ambrose Chua | 14fbdc939d | |
Ambrose Chua | bbe5659668 | |
Ambrose Chua | 7ea0fc0f01 | |
Ambrose Chua | 2ac27f11bd | |
Ambrose Chua | c97b19e1dd |
15
.drone.yml
15
.drone.yml
|
@ -1,15 +0,0 @@
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: docker
|
|
||||||
image: plugins/docker
|
|
||||||
settings:
|
|
||||||
registry: registry.makerforce.io
|
|
||||||
repo: registry.makerforce.io/pwd/caddy
|
|
||||||
tags:
|
|
||||||
- latest
|
|
||||||
username:
|
|
||||||
from_secret: docker_username
|
|
||||||
password:
|
|
||||||
from_secret: docker_password
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
name: Update, build and push Docker images
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "12 */4 * * *"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: hairyhenderson/dockerfiles-builder:latest
|
||||||
|
env:
|
||||||
|
BASHBREW_LIBRARY: ./library
|
||||||
|
BASHBREW_NAMESPACE: productionwentdown
|
||||||
|
BASHBREW_ARCH_NAMESPACES: amd64=productionwentdown
|
||||||
|
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set Git user
|
||||||
|
run: |
|
||||||
|
git config --global user.email "action@github.com"
|
||||||
|
git config --global user.name "GitHub Action"
|
||||||
|
git config --global --add safe.directory $(pwd)
|
||||||
|
|
||||||
|
- name: Install Go
|
||||||
|
run: |
|
||||||
|
apk add --no-cache go
|
||||||
|
|
||||||
|
- name: Regenerate Dockerfiles
|
||||||
|
run: |
|
||||||
|
go run update.go -dockerfiles -readme
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
id: commit-dockerfiles
|
||||||
|
run: |
|
||||||
|
git add */*/Dockerfile README.md
|
||||||
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
||||||
|
git commit -m "Bump Caddy version" -a
|
||||||
|
git push
|
||||||
|
echo "::set-output name=bumped::yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Regenerate Bashbrew manifests
|
||||||
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
|
||||||
|
run: |
|
||||||
|
go run update.go -manifest -commit $(git log -1 --format='format:%H' HEAD)
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes'
|
||||||
|
id: commit-bashbrew
|
||||||
|
run: |
|
||||||
|
git add library/caddy
|
||||||
|
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
|
||||||
|
git commit -m "Bump Caddy version" -a
|
||||||
|
git push
|
||||||
|
echo "::set-output name=bumped::yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build images on Linux
|
||||||
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
|
||||||
|
run: |
|
||||||
|
bashbrew build --pull always caddy
|
||||||
|
|
||||||
|
- name: Push images
|
||||||
|
if: steps.commit-dockerfiles.outputs.bumped == 'yes' || steps.commit-bashbrew.outputs.bumped == 'yes'
|
||||||
|
run: |
|
||||||
|
wget https://github.com/estesp/manifest-tool/releases/download/v2.1.6/binaries-manifest-tool-2.1.6.tar.gz -O manifest-tool.tar.gz
|
||||||
|
tar -xf manifest-tool.tar.gz
|
||||||
|
mv manifest-tool-linux-amd64 /usr/local/bin/manifest-tool
|
||||||
|
chmod +x /usr/local/bin/manifest-tool
|
||||||
|
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||||
|
bashbrew push caddy
|
||||||
|
bashbrew put-shared --single-arch caddy
|
||||||
|
|
||||||
|
#- name: Update Docker Hub Description
|
||||||
|
# uses: peter-evans/dockerhub-description@v2
|
||||||
|
# with:
|
||||||
|
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
# repository: productionwentdown/caddy
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: Build and push Docker images weekly
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "12 16 * * 2"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: hairyhenderson/dockerfiles-builder:latest
|
||||||
|
env:
|
||||||
|
BASHBREW_LIBRARY: ./library
|
||||||
|
BASHBREW_NAMESPACE: productionwentdown
|
||||||
|
BASHBREW_ARCH_NAMESPACES: amd64=productionwentdown
|
||||||
|
if: github.repository == 'productionwentdown/caddy' && github.ref == 'refs/heads/master'
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build images on Linux
|
||||||
|
run: |
|
||||||
|
bashbrew build --pull always caddy
|
||||||
|
|
||||||
|
- name: Push images
|
||||||
|
run: |
|
||||||
|
wget https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64 -O /usr/local/bin/manifest-tool
|
||||||
|
chmod +x /usr/local/bin/manifest-tool
|
||||||
|
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
|
||||||
|
bashbrew push caddy
|
||||||
|
bashbrew put-shared --single-arch caddy
|
|
@ -1,2 +1 @@
|
||||||
caddy.go
|
caddy.go
|
||||||
go.sum
|
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.1.1-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.1.1
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.2.1-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.2.1
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.3.0-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.3.0
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.4.6-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.4.6
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.6.4-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.6.4
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.7.6-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.7.6
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
FROM caddy:2.8.0-beta.2-alpine as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v2.8.0
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
51
Dockerfile
51
Dockerfile
|
@ -1,51 +0,0 @@
|
||||||
#
|
|
||||||
# Build stage
|
|
||||||
#
|
|
||||||
FROM golang:1.13-alpine as build
|
|
||||||
|
|
||||||
# args
|
|
||||||
ARG version="1.0.5"
|
|
||||||
# add plugin import paths here separated by commas
|
|
||||||
ARG plugins=""
|
|
||||||
ARG telemetry="true"
|
|
||||||
|
|
||||||
# build root
|
|
||||||
WORKDIR /build
|
|
||||||
|
|
||||||
# plugins
|
|
||||||
COPY plugger.go ./
|
|
||||||
|
|
||||||
# build & test
|
|
||||||
RUN apk add --no-cache git upx ca-certificates \
|
|
||||||
&& echo -e "module caddy\nrequire github.com/caddyserver/caddy v${version}" > go.mod \
|
|
||||||
&& go run plugger.go -plugins="${plugins}" -telemetry="${telemetry}" \
|
|
||||||
&& CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build \
|
|
||||||
&& upx --ultra-brute caddy \
|
|
||||||
&& ./caddy -version
|
|
||||||
|
|
||||||
#
|
|
||||||
# Final image
|
|
||||||
#
|
|
||||||
FROM scratch
|
|
||||||
|
|
||||||
# labels
|
|
||||||
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/caddy"
|
|
||||||
LABEL org.label-schema.version=${version}
|
|
||||||
LABEL org.label-schema.schema-version="1.0"
|
|
||||||
|
|
||||||
# copy binary and ca certs
|
|
||||||
COPY --from=build /build/caddy /bin/caddy
|
|
||||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
||||||
|
|
||||||
# copy default caddyfile
|
|
||||||
COPY Caddyfile /etc/Caddyfile
|
|
||||||
|
|
||||||
# set default caddypath
|
|
||||||
ENV CADDYPATH=/etc/.caddy
|
|
||||||
VOLUME /etc/.caddy
|
|
||||||
|
|
||||||
# serve from /srv
|
|
||||||
WORKDIR /srv
|
|
||||||
EXPOSE 2015
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/caddy", "--conf", "/etc/Caddyfile", "--log", "stdout"]
|
|
51
README.md
51
README.md
|
@ -1,38 +1,25 @@
|
||||||
|
|
||||||
# [caddy](https://hub.docker.com/r/productionwentdown/caddy/) [![](https://images.microbadger.com/badges/version/productionwentdown/caddy.svg)](https://microbadger.com/images/productionwentdown/caddy "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/productionwentdown/caddy.svg)](https://microbadger.com/images/productionwentdown/caddy "Get your own image badge on microbadger.com")
|
# [caddy](https://hub.docker.com/r/productionwentdown/caddy) ![Docker Pulls](https://img.shields.io/docker/pulls/productionwentdown/caddy?style=flat-square) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/productionwentdown/caddy/alpine?style=flat-square)
|
||||||
|
|
||||||
A tiny 9MB Caddy image compressed with [UPX](https://github.com/upx/upx).
|
A tiny <10MB Caddy image compressed with [UPX](https://github.com/upx/upx).
|
||||||
|
|
||||||
> Notice: I keep this manually updated. If it goes out of date, ping me via Twitter [@serverwentdown](https://twitter.com/serverwentdown).
|
- [Docker Hub](https://hub.docker.com/r/productionwentdown/caddy)
|
||||||
|
- [GitHub](https://github.com/productionwentdown/caddy)
|
||||||
|
|
||||||
|
## Simple Tags
|
||||||
|
|
||||||
|
New versions are tracked within 4 hours. Currently available versions:
|
||||||
|
|
||||||
|
* `2.8.0-beta.2-alpine`, `2.8-alpine`
|
||||||
|
* `2.7.6-alpine`, `2.7-alpine`, `2-alpine`, `alpine`
|
||||||
|
|
||||||
|
## Shared Tags
|
||||||
|
|
||||||
|
* `2.8.0-beta.2`, `2.8`
|
||||||
|
* `2.8.0-beta.2-alpine`
|
||||||
|
* `2.7.6`, `2.7`, `2`, `latest`
|
||||||
|
* `2.7.6-alpine`
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
Serve files in `$PWD`:
|
See the [official image](https://hub.docker.com/_/caddy) for documentation. This image behaves the same way, except that it is slightly slimmer.
|
||||||
```
|
|
||||||
docker run -it --rm -p 2015:2015 -v $PWD:/srv productionwentdown/caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
Overwrite `Caddyfile`:
|
|
||||||
```
|
|
||||||
docker run -it --rm -p 2015:2015 -v $PWD:/srv -v $PWD/Caddyfile:/etc/Caddyfile productionwentdown/caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
Persist `.caddy` to avoid hitting Let's Encrypt's rate limit:
|
|
||||||
```
|
|
||||||
docker run -it --rm -p 2015:2015 -v $PWD:/srv -v $PWD/Caddyfile:/etc/Caddyfile -v $HOME/.caddy:/etc/.caddy productionwentdown/caddy
|
|
||||||
```
|
|
||||||
|
|
||||||
# Build with plugins
|
|
||||||
|
|
||||||
Using `docker build` arguments:
|
|
||||||
```
|
|
||||||
docker build -t caddy --build-arg plugins=github.com/abiosoft/caddy-git,github.com/zikes/gopkg .
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also fork and edit plugger.go for more advanced plugin configuration
|
|
||||||
|
|
||||||
# Build without telemetry
|
|
||||||
|
|
||||||
```
|
|
||||||
docker build . -t caddy --build-arg telemetry=false
|
|
||||||
```
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
module github.com/productionwentdown/caddy
|
||||||
|
|
||||||
|
go 1.16
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/docker-library/go-dockerlibrary v0.0.0-20200821205225-669fbe5c1d52
|
||||||
|
pault.ag/go/debian v0.12.0 // indirect
|
||||||
|
)
|
|
@ -0,0 +1,16 @@
|
||||||
|
github.com/DataDog/zstd v1.4.8/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
|
||||||
|
github.com/docker-library/go-dockerlibrary v0.0.0-20200821205225-669fbe5c1d52 h1:Z3GnSICOyARBY/IBnOWtNN8N4AVRRDWxPEH28AM8wsg=
|
||||||
|
github.com/docker-library/go-dockerlibrary v0.0.0-20200821205225-669fbe5c1d52/go.mod h1:ijRhN3WM71dD8TfohKoUdX46BT2uz/Ek5O+5PINI880=
|
||||||
|
github.com/kjk/lzma v0.0.0-20161016003348-3fd93898850d/go.mod h1:phT/jsRPBAEqjAibu1BurrabCBNTYiVI+zbmyCZJY6Q=
|
||||||
|
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
|
||||||
|
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
pault.ag/go/debian v0.12.0 h1:b8ctSdBSGJ98NE1VLn06aSx70EUpczlP2qqSHEiYYJA=
|
||||||
|
pault.ag/go/debian v0.12.0/go.mod h1:UbnMr3z/KZepjq7VzbYgBEfz8j4+Pyrm2L5X1fzhy/k=
|
||||||
|
pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a h1:WwS7vlB5H2AtwKj1jsGwp2ZLud1x6WXRXh2fXsRqrcA=
|
||||||
|
pault.ag/go/topsort v0.0.0-20160530003732-f98d2ad46e1a/go.mod h1:INqx0ClF7kmPAMk2zVTX8DRnhZ/yaA/Mg52g8KFKE7k=
|
|
@ -0,0 +1,15 @@
|
||||||
|
Maintainers: Ambrose Chua <ambrose@makerforce.io> (@serverwentdown)
|
||||||
|
|
||||||
|
Tags: 2.8.0-beta.2-alpine, 2.8-alpine
|
||||||
|
SharedTags: 2.8.0-beta.2, 2.8
|
||||||
|
Architectures: amd64, arm32v6, arm32v7, arm64v8, ppc64le, s390x
|
||||||
|
GitRepo: https://github.com/productionwentdown/caddy.git
|
||||||
|
GitCommit: f6022c46fb03bdcd9b31e24b94eee9db96e8ba52
|
||||||
|
Directory: 2.8/alpine
|
||||||
|
|
||||||
|
Tags: 2.7.6-alpine, 2.7-alpine, 2-alpine, alpine
|
||||||
|
SharedTags: 2.7.6, 2.7, 2, latest
|
||||||
|
Architectures: amd64, arm32v6, arm32v7, arm64v8, ppc64le, s390x
|
||||||
|
GitRepo: https://github.com/productionwentdown/caddy.git
|
||||||
|
GitCommit: f6022c46fb03bdcd9b31e24b94eee9db96e8ba52
|
||||||
|
Directory: 2.7/alpine
|
61
plugger.go
61
plugger.go
|
@ -1,61 +0,0 @@
|
||||||
// +build ignore
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"flag"
|
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"text/template"
|
|
||||||
)
|
|
||||||
|
|
||||||
var plugins string
|
|
||||||
var telemetry bool
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.StringVar(&plugins, "plugins", "", "Specify plugins by full paths, seperated by commas")
|
|
||||||
flag.BoolVar(&telemetry, "telemetry", false, "Enable telemetry")
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
d := &data{
|
|
||||||
Plugins: strings.FieldsFunc(plugins, func(c rune) bool { return c == ',' }),
|
|
||||||
EnableTelemetry: telemetry,
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("Additional plugins: %v", d.Plugins)
|
|
||||||
log.Printf("Enabled telemetry: %v", d.EnableTelemetry)
|
|
||||||
|
|
||||||
f, err := os.Create("caddy.go")
|
|
||||||
defer f.Close()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("Unable to open file")
|
|
||||||
}
|
|
||||||
|
|
||||||
t := template.Must(template.New("caddy.go").Parse(caddyTemplate))
|
|
||||||
t.Execute(f, d)
|
|
||||||
}
|
|
||||||
|
|
||||||
type data struct {
|
|
||||||
Plugins []string
|
|
||||||
EnableTelemetry bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var caddyTemplate = `
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/caddyserver/caddy/caddy/caddymain"
|
|
||||||
|
|
||||||
// plug in plugins here
|
|
||||||
{{range $plugin := .Plugins}}
|
|
||||||
_ "{{$plugin}}"
|
|
||||||
{{end}}
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
// optional: disable telemetry
|
|
||||||
caddymain.EnableTelemetry = {{.EnableTelemetry}}
|
|
||||||
caddymain.Run()
|
|
||||||
}
|
|
||||||
`
|
|
|
@ -0,0 +1,220 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"strings"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/docker-library/go-dockerlibrary/manifest"
|
||||||
|
)
|
||||||
|
|
||||||
|
var manifestURL = "https://github.com/docker-library/official-images/raw/master/library/caddy"
|
||||||
|
|
||||||
|
var maintainers = []string{"Ambrose Chua <ambrose@makerforce.io> (@serverwentdown)"}
|
||||||
|
var gitRepo = "https://github.com/productionwentdown/caddy.git"
|
||||||
|
|
||||||
|
var readmeTemplate = template.Must(template.New("readme").Parse(`
|
||||||
|
# [caddy](https://hub.docker.com/r/productionwentdown/caddy) ![Docker Pulls](https://img.shields.io/docker/pulls/productionwentdown/caddy?style=flat-square) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/productionwentdown/caddy/alpine?style=flat-square)
|
||||||
|
|
||||||
|
A tiny <10MB Caddy image compressed with [UPX](https://github.com/upx/upx).
|
||||||
|
|
||||||
|
- [Docker Hub](https://hub.docker.com/r/productionwentdown/caddy)
|
||||||
|
- [GitHub](https://github.com/productionwentdown/caddy)
|
||||||
|
|
||||||
|
## Simple Tags
|
||||||
|
|
||||||
|
New versions are tracked within 4 hours. Currently available versions:
|
||||||
|
|
||||||
|
{{range $entry := .Entries}}* {{range $index, $tag := $entry.Tags}}{{if $index}}, {{end}}` + "`{{$tag}}`" + `{{end}}
|
||||||
|
{{end}}
|
||||||
|
## Shared Tags
|
||||||
|
|
||||||
|
{{range $entry := .Entries}}* {{range $index, $tag := $entry.SharedTags}}{{if $index}}, {{end}}` + "`{{$tag}}`" + `{{end}}
|
||||||
|
* ` + "`{{index $entry.Tags 0}}`" + `
|
||||||
|
{{end}}
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
See the [official image](https://hub.docker.com/_/caddy) for documentation. This image behaves the same way, except that it is slightly slimmer.
|
||||||
|
`))
|
||||||
|
|
||||||
|
var dockerfileTemplate = template.Must(template.New("name").Parse(`FROM caddy:{{.Tag}} as build
|
||||||
|
|
||||||
|
RUN apk add --no-cache upx ca-certificates \
|
||||||
|
&& upx --ultra-brute /usr/bin/caddy \
|
||||||
|
&& caddy version
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
COPY --from=build /etc/caddy/Caddyfile /etc/caddy/Caddyfile
|
||||||
|
COPY --from=build /usr/share/caddy/index.html /usr/share/caddy/index.html
|
||||||
|
COPY --from=build /usr/bin/caddy /usr/bin/caddy
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
|
COPY --from=build /etc/nsswitch.conf /etc/nsswitch.conf
|
||||||
|
|
||||||
|
ENV XDG_CONFIG_HOME=/config
|
||||||
|
ENV XDG_DATA_HOME=/data
|
||||||
|
ENV HOME=/
|
||||||
|
|
||||||
|
VOLUME /config
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.version=v{{.Version}}
|
||||||
|
LABEL org.opencontainers.image.title="Caddy (productionwentdown build)"
|
||||||
|
LABEL org.opencontainers.image.description="a powerful, enterprise-ready, open source web server with automatic HTTPS written in Go"
|
||||||
|
LABEL org.opencontainers.image.url=https://productionwentdown.makerforce.io
|
||||||
|
LABEL org.opencontainers.image.documentation=https://caddyserver.com/docs
|
||||||
|
LABEL org.opencontainers.image.vendor="productionwentdown"
|
||||||
|
LABEL org.opencontainers.image.licenses=Apache-2.0
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/productionwentdown/caddy"
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
EXPOSE 443
|
||||||
|
EXPOSE 2019
|
||||||
|
|
||||||
|
WORKDIR /srv
|
||||||
|
|
||||||
|
CMD ["/usr/bin/caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]
|
||||||
|
`))
|
||||||
|
|
||||||
|
type dockerfileData struct {
|
||||||
|
Tag string
|
||||||
|
Version string
|
||||||
|
Arch string
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
doDockerfiles := flag.Bool("dockerfiles", false, "Update Dockerfiles")
|
||||||
|
doManifest := flag.Bool("manifest", false, "Update manifest")
|
||||||
|
doReadme := flag.Bool("readme", false, "Update README.md")
|
||||||
|
commit := flag.String("commit", "", "Current commit hash")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
_, _, man, err := manifest.Fetch("nonexistent", manifestURL)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
man = subsetManifest(man)
|
||||||
|
|
||||||
|
if *doDockerfiles {
|
||||||
|
err = updateDockerfiles(man)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if *doManifest {
|
||||||
|
err = updateManifest(man, *commit)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if *doReadme {
|
||||||
|
err = updateReadme(man)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// subsetManifest returns the subset of the manifest that can be built
|
||||||
|
func subsetManifest(man *manifest.Manifest2822) *manifest.Manifest2822 {
|
||||||
|
entries := make([]manifest.Manifest2822Entry, 0, 1)
|
||||||
|
for _, entry := range man.Entries {
|
||||||
|
|
||||||
|
isWindows := false
|
||||||
|
for _, arch := range entry.Architectures {
|
||||||
|
if strings.Contains(arch, "windows") {
|
||||||
|
isWindows = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isBuilder := false
|
||||||
|
for _, tag := range entry.Tags {
|
||||||
|
if strings.Contains(tag, "builder") {
|
||||||
|
isBuilder = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if isWindows || isBuilder {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
entries = append(entries, entry)
|
||||||
|
}
|
||||||
|
return &manifest.Manifest2822{
|
||||||
|
Global: man.Global,
|
||||||
|
Entries: entries,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateDockerfiles generates a new set of Dockerfiles based on the manifest
|
||||||
|
func updateDockerfiles(man *manifest.Manifest2822) error {
|
||||||
|
for _, entry := range man.Entries {
|
||||||
|
tag := entry.Tags[0]
|
||||||
|
version := strings.Split(entry.Tags[0], "-")[0]
|
||||||
|
for _, arch := range entry.Architectures {
|
||||||
|
data := dockerfileData{Tag: tag, Version: version, Arch: arch}
|
||||||
|
err := writeDockerfile(entry, data)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: Remove old Dockerfiles
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeDockerfile(entry manifest.Manifest2822Entry, data dockerfileData) error {
|
||||||
|
dockerfilePath := path.Join(entry.ArchDirectory(data.Arch), entry.ArchFile(data.Arch))
|
||||||
|
err := os.MkdirAll(entry.ArchDirectory(data.Arch), 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dockerfileFile, err := os.OpenFile(dockerfilePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer dockerfileFile.Close()
|
||||||
|
|
||||||
|
err = dockerfileTemplate.Execute(dockerfileFile, data)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateManifest replaces upstream maintainer and Git info with this repo
|
||||||
|
func updateManifest(man *manifest.Manifest2822, gitCommit string) error {
|
||||||
|
man.Global.Maintainers = maintainers
|
||||||
|
for i := range man.Entries {
|
||||||
|
entry := &man.Entries[i]
|
||||||
|
entry.Maintainers = maintainers
|
||||||
|
entry.GitRepo = gitRepo
|
||||||
|
entry.GitCommit = gitCommit
|
||||||
|
}
|
||||||
|
manifestPath := path.Join("library", "caddy")
|
||||||
|
err := os.MkdirAll("library", 0755)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return ioutil.WriteFile(manifestPath, []byte(man.String()), 0644)
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateReadme generates a new README.md
|
||||||
|
func updateReadme(man *manifest.Manifest2822) error {
|
||||||
|
readmeFile, err := os.OpenFile("README.md", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer readmeFile.Close()
|
||||||
|
|
||||||
|
err = readmeTemplate.Execute(readmeFile, man)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue