allow user configs without custom image

This commit is contained in:
Damian Silbergleith Cunniff 2019-05-17 07:15:22 -07:00
parent 4bdc75aa81
commit caae172589
5 changed files with 24 additions and 8 deletions

View File

@ -11,13 +11,12 @@ This repository was originally forked from `@henridwyer`, many thanks to him for
# Usage # Usage
Use this image with a `Dockerfile` such as: Create a config directory for your custom configs:
```Dockerfile ```
FROM staticfloat/nginx-certbot mkdir conf.d
COPY *.conf /etc/nginx/conf.d/
``` ```
And a `.conf` file such as: And a `.conf` file such as in that directory:
```nginx ```nginx
server { server {
listen 443 ssl; listen 443 ssl;
@ -43,6 +42,8 @@ services:
- 443:443/tcp - 443:443/tcp
environment: environment:
- CERTBOT_EMAIL=owner@company.com - CERTBOT_EMAIL=owner@company.com
volumes:
- ./conf.d:/etc/nginx/user.conf.d
... ...
``` ```

View File

@ -1,2 +0,0 @@
FROM staticfloat/nginx-certbot
COPY *.conf /etc/nginx/conf.d/

View File

@ -2,10 +2,12 @@ version: '3'
services: services:
proxy: proxy:
build: . image: staticfloat/nginx-certbot
restart: always restart: always
environment: environment:
CERTBOT_EMAIL: "your.email@example.com" CERTBOT_EMAIL: "your.email@example.com"
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
volumes:
- ./conf.d:/etc/nginx/user.conf.d

View File

@ -0,0 +1,15 @@
#!/bin/sh
SOURCE_DIR=/etc/nginx/user.conf.d
TARGET_DIR=/etc/nginx/conf.d
echo "symlinking scripts from ${SOURCE_DIR} to ${TARGET_DIR}"
if [ ! -d "$SOURCE_DIR" ]; then
echo "no ${SOURCE_DIR}, nothing to do."
else
for conf in ${SOURCE_DIR}/*.conf; do
echo "symlinking: ${conf}" "${TARGET_DIR}/$(basename ${conf})"
ln -s "${conf}" "${TARGET_DIR}/$(basename ${conf})"
done
fi