diff --git a/Dockerfile b/Dockerfile index 9d78baa..101b89c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,8 @@ RUN git submodule update --init --recursive && \ FROM nginx:alpine COPY --from=builder /src/public /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod +x /docker-entrypoint.sh EXPOSE 80 +ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/docker-compose.yml b/docker-compose.yml index 40c13ea..c1baf9a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,3 +4,6 @@ services: ports: - "8080:80" restart: unless-stopped + environment: + AUTH_USER: hochzeit + AUTH_PASS: changeme diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..b304177 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e +echo "${AUTH_USER}:$(openssl passwd -apr1 "${AUTH_PASS}")" > /etc/nginx/.htpasswd +exec nginx -g "daemon off;" diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..3ed2f17 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,12 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + auth_basic "Hochzeit"; + auth_basic_user_file /etc/nginx/.htpasswd; + + location / { + try_files $uri $uri/ =404; + } +}