diff --git a/.gitignore b/.gitignore index 6f6f5e6..096d81a 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ # Go workspace file go.work go.work.sum +bin/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f4d1496 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.22 as build +WORKDIR /workspace +COPY . . +RUN mkdir state +RUN apt update && apt install unzip musl-tools -y +RUN make build-docker + +FROM alpine +WORKDIR / +RUN apk add -u ca-certificates +COPY --from=build /workspace/bin/bitwarden-sdk-server . +COPY --from=build --chown=65532:65532 /workspace/state/ ./state/ + +EXPOSE 9998 +ENV CGO_ENABLED=1 +ENV BW_SECRETS_MANAGER_STATE_PATH='/state' +ENTRYPOINT [ "/bitwarden-sdk-server" ] diff --git a/Makefile b/Makefile index aa41e10..eb6b6b4 100644 --- a/Makefile +++ b/Makefile @@ -37,8 +37,11 @@ GOLANGCI_LINT_VERSION ?= v1.57.2 ##@ Build -build: ## Builds binarie - CGO_LDFLAGS="-framework CoreFoundation" CGO_ENABLED=1 go build main.go +build: ## Builds binaries + CGO_LDFLAGS="-framework CoreFoundation" CGO_ENABLED=1 go build -ldflags='-s -w' -o $(LOCALBIN)/$(NAME) main.go + +build-docker: ## Builds binaries + CC=musl-gcc CGO_LDFLAGS="-lm" CGO_ENABLED=1 go build -a -ldflags '-linkmode external -extldflags "-static -Wl,-unresolved-symbols=ignore-all"' -o $(LOCALBIN)/$(NAME) main.go ##@ Testing diff --git a/README.md b/README.md index 451fd2a..23b4fae 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ # bitwarden-sdk-server This repository contains a simple REST wrapper for the Bitwarden Rust SDK + +# TODO + +Provide installation instructions in case it's installed separately from ESO. diff --git a/bin/golangci-lint b/bin/golangci-lint deleted file mode 100755 index ce66cb9..0000000 Binary files a/bin/golangci-lint and /dev/null differ diff --git a/main b/main deleted file mode 100755 index f2d8838..0000000 Binary files a/main and /dev/null differ