fix: update HTTP_LISTEN configuration in Dockerfile and docker-compose.yml (#1563)

* fix: update HTTP_LISTEN configuration in Dockerfile and docker-compose.yml

* cleanup HTTP_LISTEN

---------

Co-authored-by: Maxi Quoß <maxi@quoss.org>
This commit is contained in:
xiagw
2026-01-07 22:08:16 +08:00
committed by GitHub
parent 8714f937d9
commit c75679f238
5 changed files with 15 additions and 15 deletions

View File

@@ -14,11 +14,13 @@ RUN wget https://github.com/seriousm4x/UpSnap/releases/download/${VERSION}/UpSna
setcap 'cap_net_raw=+ep' ./upsnap
FROM alpine:3
ARG HTTP_LISTEN=127.0.0.1:8090
ENV HTTP_LISTEN=${HTTP_LISTEN}
RUN apk update &&\
apk add --no-cache tzdata ca-certificates nmap samba samba-common-tools openssh sshpass curl &&\
rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=downloader /app/upsnap upsnap
HEALTHCHECK --interval=10s \
CMD curl -fs "http://localhost:8090/api/health" || exit 1
ENTRYPOINT ["./upsnap", "serve", "--http=0.0.0.0:8090"]
CMD curl -fs "http://${HTTP_LISTEN}/api/health" || exit 1
ENTRYPOINT ["sh", "-c", "./upsnap serve --http $HTTP_LISTEN"]

View File

@@ -17,11 +17,13 @@ RUN go build -o upsnap main.go &&\
setcap 'cap_net_raw=+ep' ./upsnap
FROM alpine:3
ARG HTTP_LISTEN=127.0.0.1:8090
ENV HTTP_LISTEN=${HTTP_LISTEN}
RUN apk update &&\
apk add --no-cache tzdata ca-certificates nmap samba samba-common-tools openssh sshpass curl &&\
rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=go /app/upsnap upsnap
HEALTHCHECK --interval=10s \
CMD curl -fs "http://localhost:8090/api/health" || exit 1
ENTRYPOINT ["./upsnap", "serve", "--http=0.0.0.0:8090"]
CMD curl -fs "http://${HTTP_LISTEN}/api/health" || exit 1
ENTRYPOINT ["sh", "-c", "./upsnap serve --http $HTTP_LISTEN"]

View File

@@ -93,15 +93,14 @@ Then add `user: 1000:1000` to the docker-compose file (or whatever your $UID:$GI
If you want to change the port from 8090 to something else, change the following (5000 in this case):
```yml
entrypoint: /bin/sh -c "./upsnap serve --http 0.0.0.0:5000"
healthcheck:
test: curl -fs "http://localhost:5000/api/health" || exit 1
environment:
- HTTP_LISTEN=0.0.0.0:5000
```
### Install additional packages for shutdown cmd
```yml
entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http $HTTP_LISTEN"
```
You can search for your needed package [here](https://pkgs.alpinelinux.org/packages).

View File

@@ -11,6 +11,7 @@ services:
# # the container (mkdir data) so that it has the right permissions.
# user: 1000:1000
# environment:
# - HTTP_LISTEN=127.0.0.1:8090
# - TZ=Europe/Berlin # Set container timezone for cron schedules
# - UPSNAP_INTERVAL=*/10 * * * * * # Sets the interval in which the devices are pinged
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
@@ -25,4 +26,4 @@ services:
# test: curl -fs "http://localhost:5000/api/health" || exit 1
# interval: 10s
# # or install custom packages for shutdown
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http $HTTP_LISTEN"

View File

@@ -9,6 +9,7 @@ services:
# # To use a non-root user, create the mountpoint first (mkdir data) so that it has the right permission.
# user: 1000:1000
# environment:
# - HTTP_LISTEN=127.0.0.1:8090
# - TZ=Europe/Berlin # Set container timezone for cron schedules
# - UPSNAP_INTERVAL=*/10 * * * * * # Sets the interval in which the devices are pinged
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
@@ -19,10 +20,5 @@ services:
# dns:
# - 192.18.0.1
# - 192.18.0.2
# # you can change the listen ip:port inside the container like this:
# entrypoint: /bin/sh -c "./upsnap serve --http 0.0.0.0:5000"
# healthcheck:
# test: curl -fs "http://localhost:5000/api/health" || exit 1
# interval: 10s
# # or install custom packages for shutdown
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http $HTTP_LISTEN"