From df70dffebef28778004e023de694f576d66e80c5 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Fri, 30 Dec 2022 14:39:09 +0100 Subject: [PATCH] feat(caddy): prepare caddy image --- .concourse/pipeline.yml | 30 ++++++++++++++++++++++++++++ .concourse/tasks/caddy.yml | 27 +++++++++++++++++++++++++ caddy/.gitignore | 1 + caddy/Dockerfile | 9 +++++++++ caddy/config/caddy.json | 41 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 .concourse/pipeline.yml create mode 100644 .concourse/tasks/caddy.yml create mode 100644 caddy/.gitignore create mode 100644 caddy/Dockerfile create mode 100644 caddy/config/caddy.json diff --git a/.concourse/pipeline.yml b/.concourse/pipeline.yml new file mode 100644 index 0000000..c2572a1 --- /dev/null +++ b/.concourse/pipeline.yml @@ -0,0 +1,30 @@ +--- +resources: +- name: ci-images.git + type: git + icon: github + source: + uri: https://code.icb4dc0.de/prskr/ci-images.git + +- name: caddy-release + type: github-release + icon: github + source: + owner: caddyserver + repository: caddy + +jobs: + - name: images + plan: + - get: ci-images.git + trigger: true + - get: caddy-release + trigger: true + params: + globs: + - caddy_*_linux_amd64.tar.gz + - task: caddy + file: ci-images.git/.concourse/tasks/caddy.yml + input_mapping: + repo: ci-images.git + caddy: caddy-release \ No newline at end of file diff --git a/.concourse/tasks/caddy.yml b/.concourse/tasks/caddy.yml new file mode 100644 index 0000000..e98c533 --- /dev/null +++ b/.concourse/tasks/caddy.yml @@ -0,0 +1,27 @@ +--- +platform: linux + +image_resource: + type: registry-image + source: + repository: gcr.io/kaniko-project/executor + tag: debug + +inputs: + - name: repo + path: . + - name: caddy + path: caddy/caddy-release + +params: + GITEA_USER: ((gitea-credentials.user)) + GITEA_TOKEN: ((gitea-credentials.token)) + +run: + path: sh + args: + - -cex + - | + echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json + + /kaniko/executor --destination code.icb4dc0.de/prskr/ci-images/caddy:latest --context caddy/ diff --git a/caddy/.gitignore b/caddy/.gitignore new file mode 100644 index 0000000..499e9fe --- /dev/null +++ b/caddy/.gitignore @@ -0,0 +1 @@ +caddy-release/ \ No newline at end of file diff --git a/caddy/Dockerfile b/caddy/Dockerfile new file mode 100644 index 0000000..603b633 --- /dev/null +++ b/caddy/Dockerfile @@ -0,0 +1,9 @@ +FROM gcr.io/distroless/static + +ADD caddy-release/caddy_*_linux_amd64.tar.gz /usr/local/caddy +COPY config/caddy.json /etc/caddy/caddy.json + +EXPOSE 3000 + +ENTRYPOINT [ "/usr/local/caddy/caddy" ] +CMD [ "run", "--config=/etc/caddy/caddy.json" ] \ No newline at end of file diff --git a/caddy/config/caddy.json b/caddy/config/caddy.json new file mode 100644 index 0000000..19b2588 --- /dev/null +++ b/caddy/config/caddy.json @@ -0,0 +1,41 @@ +{ + "apps": { + "http": { + "servers": { + "static": { + "listen": [ + ":3000" + ], + "metrics": {}, + "routes": [ + { + "handle": [ + { + "handler": "file_server", + "root": "/usr/share/caddy", + "index_names": [ + "index.html" + ] + } + ] + } + ] + }, + "metrics": { + "listen": [ + ":9100" + ], + "routes": [ + { + "handle": [ + { + "handler": "metrics" + } + ] + } + ] + } + } + } + } +} \ No newline at end of file