Skip to content

Commit

Permalink
docker build for the project is now working
Browse files Browse the repository at this point in the history
  • Loading branch information
Skarlso committed Jun 12, 2024
1 parent 8145c72 commit 1c7f134
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
# Go workspace file
go.work
go.work.sum
bin/
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Binary file removed bin/golangci-lint
Binary file not shown.
Binary file removed main
Binary file not shown.

0 comments on commit 1c7f134

Please sign in to comment.