- Dependency Updates & Cleanup
- Frontend Security Enhancements (Nginx/Entrypoint) - Docker Networking & Binding - Code Bug Fix
This commit is contained in:
+7
-1
@@ -16,11 +16,15 @@ FROM nginx:1.27-alpine
|
||||
ARG BEOCREATE_HOST=beocreate.local
|
||||
ARG BEOCREATE_PORT=13141
|
||||
|
||||
RUN apk add --no-cache apache2-utils
|
||||
|
||||
# Copy built React app
|
||||
COPY --from=builder /build/dist /var/www/audiocontrol
|
||||
|
||||
# Generate nginx.conf with the BeoCreate address substituted
|
||||
COPY frontend/nginx.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY frontend/entrypoint.sh /usr/local/bin/audiocontrol-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/audiocontrol-entrypoint.sh
|
||||
|
||||
# nginx-envsubst will substitute $BEOCREATE_HOST and $BEOCREATE_PORT at startup
|
||||
ENV BEOCREATE_HOST=${BEOCREATE_HOST}
|
||||
@@ -29,4 +33,6 @@ ENV BEOCREATE_PORT=${BEOCREATE_PORT}
|
||||
EXPOSE 80
|
||||
|
||||
HEALTHCHECK --interval=15s --timeout=3s \
|
||||
CMD wget -qO- http://127.0.0.1/ || exit 1
|
||||
CMD wget -qO- http://127.0.0.1/health || exit 1
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/audiocontrol-entrypoint.sh"]
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${AUDIOCONTROL_USERNAME:=admin}"
|
||||
: "${AUDIOCONTROL_PASSWORD:=}"
|
||||
|
||||
if [ -n "$AUDIOCONTROL_PASSWORD" ]; then
|
||||
htpasswd -bc /etc/nginx/.htpasswd "$AUDIOCONTROL_USERNAME" "$AUDIOCONTROL_PASSWORD"
|
||||
export AUDIOCONTROL_AUTH_BASIC='"Groove Audio"'
|
||||
else
|
||||
touch /etc/nginx/.htpasswd
|
||||
export AUDIOCONTROL_AUTH_BASIC=off
|
||||
fi
|
||||
|
||||
exec /docker-entrypoint.sh "$@"
|
||||
@@ -7,6 +7,9 @@ server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
auth_basic ${AUDIOCONTROL_AUTH_BASIC};
|
||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
||||
|
||||
# Docker's internal DNS — resolves all upstreams lazily so nginx starts
|
||||
# even if a backend is temporarily unreachable at boot
|
||||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||||
@@ -15,6 +18,13 @@ server {
|
||||
root /var/www/audiocontrol;
|
||||
index index.html;
|
||||
|
||||
location = /health {
|
||||
auth_basic off;
|
||||
access_log off;
|
||||
add_header Content-Type text/plain;
|
||||
return 200 "ok\n";
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user