Skip to content

adding a dockerfile to run it #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target/
.git/
.github/
Dockerfile
Makefile
11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ bdk = "0.28"
bdk-reserves = "0.28"
env_logger = "0.10"
log = "0.4"
base64 = "^0.13"
base64 = "0.13"

[dev-dependencies]
actix-rt = "1"
actix-rt = "1"

[profile.release]
opt-level = 'z' # Optimize for size
lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = true # Strip symbols from binary*
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM rust:1.72-alpine3.18 as builder
RUN apk add --no-cache build-base
RUN adduser -S -G abuild satoshi
USER satoshi
WORKDIR /home/satoshi
COPY . .
RUN cargo test
RUN cargo build --release
RUN install -D target/release/bdk-reserves-web dist/bin/bdk-reserves-web
RUN ldd target/release/bdk-reserves-web | tr -s [:blank:] '\n' | grep ^/ | xargs -I % install -D % dist/%
RUN ln -s ld-musl-x86_64.so.1 dist/lib/libc.musl-x86_64.so.1

RUN rustup component add clippy-preview \
&& rustup component add rustfmt
RUN cargo install cargo-audit
RUN cargo fmt -- --check
RUN cargo clippy
#RUN cargo audit

FROM scratch
COPY --from=builder /home/satoshi/dist /
USER 65534
ENTRYPOINT ["/bin/bdk-reserves-web"]
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TAG := bdk-reserves-web

run: builder
docker run --rm --tty --env PORT=8888 --publish 8888:8888 ${TAG}

builder:
docker build --tag ${TAG} .