Skip to content

Commit

Permalink
get working on latest stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
withinboredom committed Jan 11, 2024
1 parent 45cb4c0 commit f9dc474
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
31 changes: 22 additions & 9 deletions init/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,40 @@
# limitations under the License.

# Versions
ARG UPSTREAM_IMAGE=rethinkdb:2.4.1

FROM golang:1.16 AS builder
FROM golang:1.21 AS builder

COPY ./rethinkdb-probe/ /go/src/rethinkdb-probe
WORKDIR /go/src/rethinkdb-probe
RUN go get ./... \
&& CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-w -s' -o /target/rethinkdb-probe .

ARG UPSTREAM_IMAGE
ENV UPSTREAM_IMAGE=${UPSTREAM_IMAGE}
FROM debian:bookworm-slim

RUN apt-get -qqy update \
&& apt-get install -y --no-install-recommends ca-certificates gnupg2 curl \
&& rm -rf /var/lib/apt/lists/*

RUN CODENAME=`lsb_release -cs` GNUPGHOME="$(mktemp -d)" && \
echo "deb https://download.rethinkdb.com/repository/debian-$CODENAME $CODENAME main" > /etc/apt/sources.list.d/rethinkdb.list && \
wget -qO- https://download.rethinkdb.com/repository/raw/pubkey.gpg | sudo apt-key add - && \
apt-get update && \
apt-get install rethinkdb && \
&& rm -rf /var/lib/apt/lists/*

VOLUME ["/data"]

WORKDIR /data

CMD ["rethinkdb", "--bind", "all"]

FROM ${UPSTREAM_IMAGE}
MAINTAINER Pozetron Inc <[email protected]>
# process cluster webui
EXPOSE 28015 29015 8080

RUN apt-get update && \
apt-get install -yq curl && \
rm -rf /var/cache/apt/* && rm -rf /var/lib/apt/lists/*

ADD http://stedolan.github.io/jq/download/linux64/jq /usr/bin/jq
RUN chmod +x /usr/bin/jq
COPY jq /usr/bin/jq

ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init
Expand Down
2 changes: 1 addition & 1 deletion init/files/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [[ -n "${KUBERNETES_SERVICE_HOST}" ]]; then
token=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
# try to pick up first different ip from endpoints
IP=$(curl -s ${URL} --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt --header "Authorization: Bearer ${token}" \
| jq -s -r --arg h "${POD_IP}" '.[0].subsets | .[].addresses | [ .[].ip ] | map(select(. != $h)) | .[0]') || exit 1
| jq -s -r --arg h "${POD_IP}" '.[0].subsets | try .[].addresses | [ .[].ip ] | try map(select(. != $h)) | .[0]') || exit 1
[[ "${IP}" == null ]] && IP=""
JOIN_ENDPOINTS="${IP}"
fi
Expand Down

0 comments on commit f9dc474

Please sign in to comment.