Skip to content

Commit c33ac40

Browse files
committed
add docker setup
1 parent d4a9cc8 commit c33ac40

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM python:3.11-slim AS builder
2+
3+
RUN apt-get update && apt-get install -y git
4+
5+
RUN git clone https://github.com/stackitcloud/certbot-dns-stackit.git /src
6+
WORKDIR /src
7+
RUN pip install --prefix=/install .
8+
9+
FROM certbot/certbot:v3.3.0
10+
11+
COPY --from=builder /install /usr/local
12+
WORKDIR /etc/letsencrypt
13+
14+
ENTRYPOINT ["certbot"]

examples/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
DOMAIN=example.com
2+
WILDCARD=*.example.com

examples/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.ini

examples/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: '3.8'
2+
3+
services:
4+
certbot:
5+
build:
6+
context: .
7+
dockerfile: ../Dockerfile
8+
container_name: certbot-stackit
9+
volumes:
10+
- ./letsencrypt:/etc/letsencrypt
11+
- ./stackit.ini:/stackit.ini:ro
12+
entrypoint: certbot
13+
command: >
14+
certonly
15+
--dns-stackit
16+
--dns-stackit-credentials /stackit.ini
17+
--dns-stackit-propagation-seconds 60
18+
-d "${WILDCARD}" -d "${DOMAIN}"
19+
certbot-renew:
20+
build:
21+
context: .
22+
dockerfile: ../Dockerfile
23+
container_name: certbot-renew
24+
volumes:
25+
- ./letsencrypt:/etc/letsencrypt
26+
- ./stackit.ini:/stackit.ini:ro
27+
entrypoint: certbot
28+
command: renew

examples/readme.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Certbot with Stackit DNS Plugin (Docker Compose)
2+
3+
- Custom Docker image: Based on certbot/certbot, with the Stackit DNS plugin installed.
4+
- Docker Compose service to request wildcard certificates.
5+
6+
---
7+
## 📂 Certificate File Structure
8+
9+
```
10+
./letsencrypt/live/<your-domain>/
11+
├── cert.pem # Your domain’s certificate
12+
├── chain.pem # The Let's Encrypt chain
13+
├── fullchain.pem # cert.pem + chain.pem (what you usually use)
14+
├── privkey.pem # Your private key
15+
```
16+
17+
18+
## 🛠️ Setup Instructions
19+
20+
21+
### 1. Create a file named `stackit.ini` in the root directory:
22+
23+
⚠️️️ Make sure the file is secure: (`chmod 600 stackit.ini`)
24+
```
25+
dns_stackit_api_token = YOUR_API_TOKEN
26+
dns_stackit_project_id = YOUR_PROJECT_ID
27+
```
28+
29+
### 2. Set domain in `.env` file
30+
```
31+
DOMAIN=example.com
32+
WILDCARD=*.example.com
33+
```
34+
35+
### 3. Run Certbot
36+
```
37+
docker compose up certbot
38+
```

0 commit comments

Comments
 (0)