2022-09-04 21:21:33 +00:00
|
|
|
FROM alpine:latest as builder
|
|
|
|
|
2023-02-19 11:08:15 +00:00
|
|
|
ARG BW_VERSION=2023.1.0
|
2022-09-04 21:21:33 +00:00
|
|
|
|
|
|
|
RUN apk add wget unzip
|
|
|
|
|
|
|
|
RUN cd /tmp && wget https://github.com/bitwarden/clients/releases/download/cli-v${BW_VERSION}/bw-linux-${BW_VERSION}.zip && \
|
|
|
|
unzip /tmp/bw-linux-${BW_VERSION}.zip
|
|
|
|
|
2023-04-21 12:39:06 +00:00
|
|
|
FROM alpine:3.17.3
|
2022-09-04 21:21:33 +00:00
|
|
|
|
2023-04-21 13:51:51 +00:00
|
|
|
ARG PYTHON_VERSION=3.10.11-r0
|
2022-12-18 11:09:26 +00:00
|
|
|
ARG PIP_VERSION=22.3.1-r1
|
|
|
|
ARG GCOMPAT_VERSION=1.1.0-r0
|
|
|
|
|
2022-09-04 21:21:33 +00:00
|
|
|
COPY --from=builder /tmp/bw /usr/local/bin/bw
|
|
|
|
COPY requirements.txt requirements.txt
|
|
|
|
|
|
|
|
RUN set -eux; \
|
2022-11-19 23:57:01 +00:00
|
|
|
addgroup -S -g 1000 bw-operator; \
|
|
|
|
adduser -S -D -u 1000 -G bw-operator bw-operator; \
|
2022-09-04 21:21:33 +00:00
|
|
|
mkdir -p /home/bw-operator; \
|
|
|
|
chown -R bw-operator /home/bw-operator; \
|
|
|
|
chmod +x /usr/local/bin/bw; \
|
2023-02-19 11:08:15 +00:00
|
|
|
apk add gcc musl-dev libstdc++ gcompat=${GCOMPAT_VERSION} python3=${PYTHON_VERSION} py3-pip=${PIP_VERSION}; \
|
2022-11-19 23:57:01 +00:00
|
|
|
pip install -r requirements.txt --no-warn-script-location; \
|
|
|
|
apk del --purge gcc musl-dev libstdc++;
|
2022-09-04 21:21:33 +00:00
|
|
|
|
2022-11-12 22:57:42 +00:00
|
|
|
COPY --chown=bw-operator:bw-operator src /home/bw-operator
|
2022-09-04 21:21:33 +00:00
|
|
|
|
|
|
|
USER bw-operator
|
|
|
|
|
2022-12-26 15:29:14 +00:00
|
|
|
ENTRYPOINT [ "kopf", "run", "--log-format=json", "--all-namespaces", "--liveness=http://0.0.0.0:8080/healthz" ]
|
2022-11-26 17:55:42 +00:00
|
|
|
CMD [ "/home/bw-operator/bitwardenCrdOperator.py", "/home/bw-operator/kv.py", "/home/bw-operator/dockerlogin.py", "/home/bw-operator/template.py"]
|