Skip to content

Commit cb5197c

Browse files
authored
feat: extend default Dockerfile (#50)
1 parent 190cdc0 commit cb5197c

File tree

2 files changed

+49
-9
lines changed

2 files changed

+49
-9
lines changed

.dockerignore

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Rust template
2+
# Generated by Cargo
3+
# will have compiled files and executables
4+
debug/
5+
target/
6+
7+
# These are backup files generated by rustfmt
8+
**/*.rs.bk
9+
10+
# MSVC Windows builds of rustc generate these, which store debugging information
11+
*.pdb
12+
13+
# RustRover
14+
.idea/
15+
16+
# Git
17+
.git/
18+
.github/
19+
20+
# Testing
21+
tests/
22+
test_assets/
23+
24+
# Soldeer
25+
dependencies/

Dockerfile

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
FROM {{base-image}} AS chef
2-
3-
RUN cargo install cargo-chef
1+
FROM lukemathwalker/cargo-chef:latest-rust-bookworm AS chef
42
WORKDIR /app
53

6-
COPY Cargo.toml Cargo.lock ./
7-
4+
FROM chef AS planner
5+
COPY . .
86
RUN cargo chef prepare --recipe-path recipe.json
9-
RUN cargo chef cook --recipe-path recipe.json
107

8+
FROM chef AS builder
9+
COPY --from=planner /app/recipe.json recipe.json
10+
RUN cargo chef cook --release --recipe-path recipe.json
11+
12+
FROM ghcr.io/foundry-rs/foundry:latest AS foundry
13+
14+
FROM chef AS app-builder
1115
COPY . .
1216

13-
RUN cargo build --release
17+
COPY --from=foundry /usr/local/bin/forge /usr/local/bin/forge
18+
COPY --from=foundry /usr/local/bin/cast /usr/local/bin/cast
19+
COPY --from=foundry /usr/local/bin/anvil /usr/local/bin/anvil
20+
21+
RUN cargo build --release --all
1422

1523
FROM debian:bookworm-slim AS runtime
1624
WORKDIR /app
17-
COPY --from=chef /app/target/release/{{project-name}} /usr/local/bin
25+
26+
RUN apt-get update && \
27+
apt-get install -y libssl3 && \
28+
rm -rf /var/lib/apt/lists/*
29+
30+
COPY --from=app-builder /app/target/release/{{project-name}}-blueprint-bin /usr/local/bin
1831

1932
LABEL org.opencontainers.image.authors="{{authors}}"
2033
LABEL org.opencontainers.image.description="{{project-description}}"
@@ -26,5 +39,7 @@ ENV BIND_ADDR="0.0.0.0"
2639
ENV BIND_PORT=9632
2740
ENV BLUEPRINT_ID=0
2841
ENV SERVICE_ID=0
42+
ENV CHAIN="testnet"
43+
ENV KEYSTORE_URI="./keystore"
2944

30-
ENTRYPOINT ["/usr/local/bin/{{project-name}}", "run"]
45+
ENTRYPOINT ["/usr/local/bin/{{project-name}}-blueprint-bin", "run"]

0 commit comments

Comments
 (0)