Skip to content

Commit

Permalink
Set --webaddr to obtained container IP (#3114)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzen authored Jan 29, 2025
1 parent 3075b06 commit 0ac97e3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
client/webserver/site/node_modules/
spec/
docs/
5 changes: 3 additions & 2 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build
FROM debian:buster-slim
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates
WORKDIR /dex
ENV HOME /dex
ENV HOME=/dex
RUN mkdir -p /dex/.dexc && chown 1000 /dex/.dexc
USER 1000
COPY --from=gobuilder /root/dex/client/cmd/bisonw/bisonw ./
COPY --from=gobuilder /root/dex/client/cmd/bwctl/bwctl ./
COPY ./client/entrypoint.sh ./
EXPOSE 5758
CMD [ "./bisonw", "--webaddr=0.0.0.0:5758" ]
ENTRYPOINT [ "./entrypoint.sh" ]
5 changes: 3 additions & 2 deletions client/Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build
FROM debian:buster-slim
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates
WORKDIR /dex
ENV HOME /dex
ENV HOME=/dex
RUN mkdir -p /dex/.dexc && chown 1000 /dex/.dexc
USER 1000
COPY --from=gobuilder /root/dex/client/cmd/bisonw/bisonw ./
COPY --from=gobuilder /root/dex/client/cmd/bwctl/bwctl ./
COPY ./client/entrypoint.sh ./
EXPOSE 5758
CMD [ "./bisonw", "--webaddr=0.0.0.0:5758" ]
ENTRYPOINT [ "./entrypoint.sh" ]
11 changes: 11 additions & 0 deletions client/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# Get the IP address of the primary network interface
IP_ADDRESS=$(hostname -I | awk '{print $1}')

CMD="./bisonw"
if [ "$IP_ADDRESS" != "" ]; then
CMD="$CMD --webaddr $IP_ADDRESS:5758"
fi

exec $CMD

0 comments on commit 0ac97e3

Please sign in to comment.