Sign inSign up

insight4upublic/mkcert

By insight4upublic

•Updated almost 3 years ago

quick certificate generation

Image
0

266

insight4upublic/mkcert repository overview

⁠docker-mkcert

Dockerized certificate generation using mkcert.
On docker build, the latest dev repo is pulled in the image.
Developer repo: https://github.com/FiloSottile/mkcert⁠

⁠Docker Compose
x-volume-localtime:
  &etclocaltime
  type: 'bind'
  source: /etc/localtime
  target: /etc/localtime
  read_only: true
x-volume-certs:
  &certs
  type: 'bind'
  source: /mnt/docker/networkstack/certs
  target: /certs
  bind:
    create_host_path: true

services:
  mkcert:
    image: insight4upublic/mkcert
    volumes:
      - <<: *etclocaltime
      - <<: *certs
    user: "0"
    command: >
      bash -c '
        if [ x${DOMAIN} == x ]; then
          echo "Set the DOMAIN environment variable in the .env file";
          exit 1;
        fi;
        if [ ! -f /certs/key.pem ]; then
          echo "/certs/key.pem does not exist yet.";
          echo "Creating certificates";
          echo "running> mkcert -key-file /certs/key.pem -cert-file /certs/cert.pem ${DOMAIN} *.${DOMAIN}";
          mkcert -key-file /certs/key.pem -cert-file /certs/cert.pem ${DOMAIN} *.${DOMAIN};
        else
          echo "Certificates exist in volume certs";
          echo "To generate new certificates, delete the old ones";
        fi;
      '
    healthcheck:
      test: ["CMD-SHELL", "[ -f /certs/key.pem ]"]
      interval: 1s
      timeout: 5s
      retries: 120

Tag summary

Content type

Image

Digest

sha256:71529bda8…

Size

296.5 MB

Last updated

almost 3 years ago

docker pull insight4upublic/mkcert