Standalone with https
This commit is contained in:
@@ -4,8 +4,10 @@ FROM $BUILD_FROM
|
||||
ENV HASS_HOST=
|
||||
ENV HASS_TOKEN=
|
||||
ENV HASS_AUTOINCLUDE=0
|
||||
ENV HTTPS=1
|
||||
|
||||
# Copy data for add-on
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY hassapi.class.php /home
|
||||
COPY hass_cb.php /home
|
||||
COPY state_post.sh /home
|
||||
@@ -18,7 +20,16 @@ RUN chmod a+x /run.sh
|
||||
# Install AirSendWebService
|
||||
RUN mkdir -p /home && cd /home && wget http://devmel.com/dl/AirSendWebService.tgz && tar -zxvf AirSendWebService.tgz && chmod -R 777 bin
|
||||
|
||||
RUN apk add php php-curl
|
||||
# Install Services
|
||||
RUN apk add php php-curl nginx openssl
|
||||
|
||||
# Generate self-signed certificate
|
||||
RUN mkdir -p /etc/nginx/ssl
|
||||
RUN openssl req -x509 -nodes -days 3650 -newkey rsa:2048 \
|
||||
-subj "/C=FR/ST=France/L=Paris/O=AirSendWebService/CN=localhost" \
|
||||
-keyout /etc/nginx/ssl/selfsigned.key \
|
||||
-out /etc/nginx/ssl/selfsigned.crt
|
||||
|
||||
# Start AirSendWebService
|
||||
CMD [ "/run.sh" ]
|
||||
EXPOSE 33863
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
events {}
|
||||
http {
|
||||
server {
|
||||
listen 33863 ssl;
|
||||
server_name _;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/selfsigned.crt;
|
||||
ssl_certificate_key /etc/nginx/ssl/selfsigned.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:33864;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-5
@@ -9,11 +9,8 @@ case "$arch" in \
|
||||
amd64) arch='x86_64' ;; \
|
||||
i386) arch='x86' ;; \
|
||||
esac;
|
||||
echo "AirSendWebService arch: ${arch}"
|
||||
|
||||
# Start AirSendWebService
|
||||
ulimit -n 4096
|
||||
./bin/unix/${arch}/AirSendWebService 99399
|
||||
echo "AirSendWebService arch: ${arch}"
|
||||
|
||||
CALLBACK_PID=
|
||||
if [ -n "${SUPERVISOR_TOKEN:-}" ]
|
||||
@@ -21,14 +18,33 @@ then
|
||||
hname="$(hostname -i)"
|
||||
echo "internal_url: http://${hname}:33863/"
|
||||
echo $(bashio::config 'auto_include') > auto_include.cfg
|
||||
# Start AirSendWebService
|
||||
./bin/unix/${arch}/AirSendWebService 99399
|
||||
# Start hass callback service
|
||||
php -S 127.0.0.1:80 hass_cb.php & CALLBACK_PID=$!
|
||||
elif [ -n "${HASS_HOST:-}" ] && [ -n "${HASS_TOKEN:-}" ]
|
||||
then
|
||||
echo "internal_url: http://{YOUR_DOCKER_MACHINE_IP}:33863/"
|
||||
# Start AirSendWebService
|
||||
if [ "${HTTPS:-0}" -eq 1 ]; then
|
||||
./bin/unix/${arch}/AirSendWebService 33864
|
||||
nginx
|
||||
echo "internal_url: https://{YOUR_DOCKER_MACHINE_IP}:33863/"
|
||||
else
|
||||
./bin/unix/${arch}/AirSendWebService 99399
|
||||
echo "internal_url: http://{YOUR_DOCKER_MACHINE_IP}:33863/"
|
||||
fi
|
||||
# Start hass callback service
|
||||
php -S 127.0.0.1:80 hass_cb.php & CALLBACK_PID=$!
|
||||
else
|
||||
# Start AirSendWebService
|
||||
if [ "${HTTPS:-0}" -eq 1 ]; then
|
||||
./bin/unix/${arch}/AirSendWebService 33864
|
||||
nginx
|
||||
echo "example: curl -k https://{YOUR_DOCKER_MACHINE_IP}:33863/"
|
||||
else
|
||||
./bin/unix/${arch}/AirSendWebService 99399
|
||||
echo "example: curl http://{YOUR_DOCKER_MACHINE_IP}:33863/"
|
||||
fi
|
||||
echo "Running the AirSendWebService only..."
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user