Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Dockerfile for running the plugin in a container #22

Closed
naioja opened this issue Aug 12, 2022 · 3 comments · Fixed by #31
Closed

Simple Dockerfile for running the plugin in a container #22

naioja opened this issue Aug 12, 2022 · 3 comments · Fixed by #31
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@naioja
Copy link
Contributor

naioja commented Aug 12, 2022

Hello,

For anyone wanting to use this plugin in a container I have the following example:

FROM alpine:latest

RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools certbot certbot-dns-azure

The docker build command would simply be:

docker build -t certbot-azuredns -f Dockerfile .

As an example the newly created container can be used as follows (a bit brave to mount directly the host's /etc/letsencrypt directory):

docker run -it --rm --name certbot-azure-dns \
           -v /etc/letsencrypt/:/etc/letsencrypt/ \
           certbot-azuredns \
           certbot certonly \
           --authenticator dns-azure \
           --preferred-challenges dns \
           --agree-tos \
           --email '[email protected]' \
           --noninteractive \
           --dns-azure-config /etc/letsencrypt/clouddns/azuredns.ini \
           --domains example.com \
           --domains '*.example.com'

And the contents of the azuredns.ini is as per the service principal example with 400 permission.

dns_azure_sp_client_id = AAA...
dns_azure_sp_client_secret = BBB...
dns_azure_tenant_id = CCC...

dns_azure_environment = "AzurePublicCloud"

dns_azure_zone1 = example.com:/subscriptions/DDD.../resourceGroups/rg-dns001

Please let me know if code snippet above this is adequate to be included in a subsequent PR.

@yummypho
Copy link

This was very useful and I appreciate the example with wildcards. Below is a complimentary dockerfile in case it helps anyone; I find docker compose easier to read.

version: '3.7'
services:
  certbot-azure-dns-1:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: certbot-azure-dns-1
	command: 
	  - certbot 
	  - certonly
	  - "[email protected]"
	  - "--authenticator=dns-azure"
	  - "--preferred-challenges=dns"
	  - "--agree-tos"
	  - "--noninteractive" 
	  - "--dns-azure-config=/secret/azure.ini"
	  - "--domains=example.org"
	  - "--domains=*.example.org"
    volumes:
      - "./letsencrypt:/etc/letsencrypt"
      - "./secret:/secret:ro"

@terricain
Copy link
Owner

Hey, sorry, didn't have notifications on for this repo for a while. @naioja please PR and update the readme with a section relating to this 😄

@terricain terricain added enhancement New feature or request good first issue Good for newcomers labels Mar 5, 2023
naioja added a commit to naioja/certbot-dns-azure that referenced this issue Mar 9, 2023
@naioja
Copy link
Contributor Author

naioja commented Mar 9, 2023

@terrycain please have a look at #31

terricain pushed a commit that referenced this issue Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants