Skip to content

Commit

Permalink
update proxy addon to use alpine 3.20 and use the /app workdir in
Browse files Browse the repository at this point in the history
general.
  • Loading branch information
jens-maus committed Nov 15, 2024
1 parent f31e4bb commit 990c043
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
16 changes: 7 additions & 9 deletions home-assistant-addon-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG BUILD_FROM
FROM $BUILD_FROM

# set workdir to /app
WORKDIR /app
ENV NODE_PATH=/app/node_modules

# Install nodejs and specific npm version to fix
# install stalling on armv7/armhf
Expand All @@ -12,16 +12,14 @@ RUN apk add --no-cache --update npm

# Install express + http-proxy-middleware packages for
# ha-proxy.js
ENV NODE_PATH=/app/node_modules
RUN npm install express
RUN npm install http-proxy-middleware

# Copy root filesystem
ADD ha-proxy.js.gtpl /
ADD entrypoint.sh /

RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/bin/sh", "-c", "/entrypoint.sh"]
# Copy root filesystem and set permissions
ADD ha-proxy.js.gtpl /app
ADD entrypoint.sh /app
RUN chmod +x /app/entrypoint.sh

# Build arguments
ARG BUILD_ARCH
Expand All @@ -48,4 +46,4 @@ LABEL \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION}

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/app/entrypoint.sh"]
10 changes: 5 additions & 5 deletions home-assistant-addon-proxy/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
build_from:
aarch64: ghcr.io/home-assistant/aarch64-base:3.18
amd64: ghcr.io/home-assistant/amd64-base:3.18
armhf: ghcr.io/home-assistant/armhf-base:3.18
armv7: ghcr.io/home-assistant/armv7-base:3.18
i386: ghcr.io/home-assistant/i386-base:3.18
aarch64: ghcr.io/home-assistant/aarch64-base:3.20
amd64: ghcr.io/home-assistant/amd64-base:3.20
armhf: ghcr.io/home-assistant/armhf-base:3.20
armv7: ghcr.io/home-assistant/armv7-base:3.20
i386: ghcr.io/home-assistant/i386-base:3.20
10 changes: 7 additions & 3 deletions home-assistant-addon-proxy/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: RaspberryMatic CCU (Proxy)
version: 0.2.8
version: 0.2.9
stage: experimental
slug: raspberrymatic_proxy
image: ghcr.io/jens-maus/raspberrymatic-proxy
Expand All @@ -19,10 +19,14 @@ panel_icon: mdi:router-wireless
boot: auto
init: true
timeout: 30
ports:
8099/tcp: null
ports_description:
8099/tcp: External port to proxied WebUI
options:
server: "http://homematic-raspi:80"
webui-url: http://homematic-raspi:80
schema:
server: url?
webui-url: str?
map:
- config:ro
environment:
Expand Down
11 changes: 3 additions & 8 deletions home-assistant-addon-proxy/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#!/bin/sh
set -x
tempio -conf /data/options.json -template /ha-proxy.js.gtpl -out /bin/ha-proxy.js
chmod a+rx /bin/ha-proxy.js
ls -la /usr/bin/node
ls -la /bin/ha-proxy.js
ls -la /
ls -la /app/
exec /bin/ha-proxy.js
tempio -conf /data/options.json -template /app/ha-proxy.js.gtpl -out /app/ha-proxy.js
chmod a+rx /app/ha-proxy.js
exec /app/ha-proxy.js
2 changes: 1 addition & 1 deletion home-assistant-addon-proxy/ha-proxy.js.gtpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { createProxyMiddleware, responseInterceptor } = require('http-proxy-middl
const ipaddr = require('ipaddr.js');

const apiProxy = createProxyMiddleware({
target: '{{ .server }}',
target: '{{ .webui-url }}',
pathFilter: '/',
changeOrigin: true, // for vhosted sites
//logger: console,
Expand Down

0 comments on commit 990c043

Please sign in to comment.