This commit is contained in:
parent
cb9bd4cb26
commit
f554d94269
2 changed files with 88 additions and 0 deletions
32
Dockerfile
Normal file
32
Dockerfile
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
FROM rust:alpine AS chef
|
||||
RUN apk add --no-cache musl-dev lld g++ make perl openssl-dev openssl-libs-static protobuf-dev ca-certificates
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
|
||||
ENV SQLX_OFFLINE=true
|
||||
ENV RUSTFLAGS="-C target-feature=+aes,+sse -C relocation-model=static -C linker=ld.lld"
|
||||
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/app/target \
|
||||
cargo chef cook --recipe-path recipe.json --target x86_64-unknown-linux-musl
|
||||
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/app/target \
|
||||
cargo build --target x86_64-unknown-linux-musl && \
|
||||
mkdir -p /app/dist && \
|
||||
cp /app/target/x86_64-unknown-linux-musl/debug/nex-account /app/dist/
|
||||
|
||||
FROM scratch AS final
|
||||
WORKDIR /
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /app/dist/nex-account /nex-account
|
||||
ENTRYPOINT ["/nex-account"]
|
||||
Loading…
Reference in a new issue