Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

Commit 461196e

Browse files
authored
Merge pull request #84 from sineverba/docker-dev
Docker dev
2 parents a763156 + 32acd52 commit 461196e

10 files changed

Lines changed: 2432 additions & 0 deletions

File tree

.semaphore/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
version: v1.0
2+
3+
name: Build and deploy Pipeline
4+
agent:
5+
machine:
6+
type: e1-standard-2
7+
os_image: ubuntu1804
8+
execution_time_limit:
9+
hours: 3
10+
11+
global_job_config:
12+
13+
prologue:
14+
commands:
15+
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
16+
17+
env_vars:
18+
- name: DOCKER_USERNAME
19+
value: sineverba
20+
- name: DOCKER_IMAGE
21+
value: cfhookbash
22+
23+
blocks:
24+
- name: 'Build and deploy'
25+
task:
26+
jobs:
27+
- name: 'Build and deploy'
28+
commands:
29+
- checkout
30+
- docker -v
31+
- mkdir -vp ~/.docker/cli-plugins/
32+
- curl --silent -L "https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64" > ~/.docker/cli-plugins/docker-buildx
33+
- chmod a+x ~/.docker/cli-plugins/docker-buildx
34+
- docker buildx version
35+
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
36+
- docker buildx create --name mybuilder && docker buildx use mybuilder && docker buildx inspect --bootstrap
37+
- docker buildx build --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7 --tag $DOCKER_USERNAME/$DOCKER_IMAGE:$SEMAPHORE_GIT_TAG_NAME --tag $DOCKER_USERNAME/$DOCKER_IMAGE:latest --file ./docker/Dockerfile . --push
38+
secrets:
39+
- name: DOCKER_TOKEN

.semaphore/semaphore.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: v1.0
2+
3+
name: Build and test Pipeline
4+
agent:
5+
machine:
6+
type: e1-standard-2
7+
os_image: ubuntu1804
8+
9+
global_job_config:
10+
11+
prologue:
12+
commands:
13+
- echo $DOCKER_TOKEN | docker login --username "$DOCKER_USERNAME" --password-stdin
14+
15+
env_vars:
16+
- name: DOCKER_USERNAME
17+
value: sineverba
18+
- name: DOCKER_IMAGE
19+
value: cfhookbash
20+
21+
blocks:
22+
- name: 'Build and test'
23+
skip:
24+
when: "tag =~ '.*'"
25+
task:
26+
jobs:
27+
- name: 'Build and test'
28+
commands:
29+
- checkout
30+
- docker build --tag $DOCKER_USERNAME/$DOCKER_IMAGE --file ./docker/Dockerfile .
31+
- docker run -it --rm --name cfhookbash $DOCKER_USERNAME/$DOCKER_IMAGE | grep "Using main config file /app/dehydrated/config"
32+
- docker run -it --rm --name cfhookbash $DOCKER_USERNAME/$DOCKER_IMAGE | grep "Registering account"
33+
34+
secrets:
35+
- name: DOCKER_TOKEN
36+
37+
promotions:
38+
- name: Deploy
39+
pipeline_file: deploy.yml
40+
auto_promote:
41+
when: "result = 'passed' and tag =~ '.*'"

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Next version
22
+ Remove Docker implementation (not completed)
33
+ Remove config folder (for old Docker)
4+
+ Add Dockerfile
5+
+ Add instructions for Docker
6+
+ Add semaphore
7+
+ Fix semaphore
48

59
## 4.2.0
610
+ Add hook-chaining support

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
build:
2+
docker build --tag sineverba/cfhookbash:latest --file ./docker/Dockerfile .
3+
4+
multi:
5+
docker buildx build --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7 --tag sineverba/cfhookbash:latest --file ./docker/Dockerfile . --push
6+
7+
run:
8+
#docker run -it -v ${PWD}/certs:/certs -v ${PWD}/config:/config --name cfhookbash sineverba/cfhookbash:latest
9+
docker run -it --rm --name cfhookbash sineverba/cfhookbash:latest
10+
11+
test:
12+
docker run -it --rm --name cfhookbash sineverba/cfhookbash:latest | grep "INFO: Using main config file /app/dehydrated/config"
13+
docker run -it --rm --name cfhookbash sineverba/cfhookbash:latest | grep "Registering account"
14+
15+
inspect:
16+
#docker run -it --entrypoint "/bin/bash" -v ${PWD}/certs:/certs -v ${PWD}/config:/config cfhookbash
17+
docker run -it --entrypoint "/bin/bash" cfhookbash
18+
19+
destroy:
20+
docker image rm sineverba/cfhookbash:latest

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Cloudflare dns-01 challenge hook bash for dehydrated
22
====================================================
33

4+
| CD / CI | |
5+
| --------- | --------- |
6+
| Semaphore CI | [![Build Status](https://sineverba.semaphoreci.com/badges/cfhookbash/branches/master.svg)](https://sineverba.semaphoreci.com/projects/cfhookbash) |
7+
48
**If you like this project, or use it, please, star it!**
59

610
Cloudflare Bash hook for [dehydrated](https://github.com/lukas2511/dehydrated).
@@ -131,3 +135,19 @@ Everyone is welcome to contribute! See `CONTRIBUTING.md`
131135
Inspired by
132136
+ [https://www.splitbrain.org/blog/2017-08/10-homeassistant_duckdns_letsencrypt](https://www.splitbrain.org/blog/2017-08/10-homeassistant_duckdns_letsencrypt)
133137
+ [https://github.com/kappataumu/letsencrypt-Cloudflare-hook](https://github.com/kappataumu/letsencrypt-Cloudflare-hook)
138+
139+
## Docker version
140+
141+
+ Pull from Docker Hub: `docker pull sineverba/cfhookbash`
142+
+ Make a first run, it will create the correct directories and files:
143+
144+
```shell
145+
$ docker run -it --rm -v $(pwd)/data:/app/dehydrated --name cfhookbash sineverba/cfhookbash:latest
146+
```
147+
+ Edit `data/config`, `data/config.sh` and `data/domains.txt`
148+
+ Rerun:
149+
150+
```shell
151+
$ docker run -it --rm -v $(pwd)/data:/app/dehydrated --name cfhookbash sineverba/cfhookbash:latest
152+
```
153+

docker/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM alpine:3.13.1
2+
3+
RUN apk add --no-cache bash curl jq openssl --upgrade grep
4+
5+
RUN mkdir -p dehydrated /app/dehydrated
6+
7+
COPY docker/dehydrated/ /dehydrated/
8+
RUN chmod +x /dehydrated/dehydrated
9+
10+
COPY ./hook.sh /dehydrated
11+
COPY ./config.default.sh /dehydrated/config.sh
12+
13+
COPY docker/docker-entrypoint.sh /usr/local/bin/
14+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
15+
16+
ENTRYPOINT [ "docker-entrypoint.sh" ]

docker/dehydrated/config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CA="https://acme-staging-v02.api.letsencrypt.org/directory"

0 commit comments

Comments
 (0)