Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
fix bitwarden cli not working on alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
BlowaXD committed Mar 28, 2024
1 parent 31d0a0a commit f2d929e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ RUN --mount=type=bind,source=src,target=src \
cargo build --locked --release && \
cp ./target/release/$APP_NAME /bin/bitwarden-secret-operator-rs


FROM alpine:latest as downloader

ARG BW_VERSION=2024.2.1

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

################################################################################
# Create a new stage for running the application that contains the minimal
# runtime dependencies for the application. This often uses a different base
Expand All @@ -40,23 +50,24 @@ cp ./target/release/$APP_NAME /bin/bitwarden-secret-operator-rs
# By specifying the "3.18" tag, it will use version 3.18 of alpine. If
# reproducability is important, consider using a digest
# (e.g., alpine@sha256:664888ac9cfd28068e062c991ebcff4b4c7307dc8dd4df9e728bedde5c449d91).
FROM alpine:3.18 AS final
FROM debian:bookworm AS final


# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--home "/home/operator-user" \
--uid "${UID}" \
appuser
USER appuser
operator-user
USER operator-user

RUN mkdir -p /home/operator-user/.config/Bitwarden\ CLI && touch /home/operator-user/.config/Bitwarden\ CLI/data.json

# Copy the executable from the "build" stage.
COPY --from=build /bin/bitwarden-secret-operator-rs /bin/
COPY --from=downloader /tmp/bw /bin/

# Expose the port that the application listens on.
EXPOSE 3001
Expand Down
4 changes: 4 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
services:
bitwarden-secret-operator-rs:
environment:
BW_CLIENTID: client
BW_CLIENTSECRET: secret
BW_PASSWORD: password
build:
context: .
target: final
Expand Down

0 comments on commit f2d929e

Please sign in to comment.