mirror of https://git.sr.ht/~garritfra/sabre
Garrit Franke
3 years ago
2 changed files with 40 additions and 0 deletions
@ -0,0 +1,10 @@ |
|||||||
|
*_out/ |
||||||
|
.builds/ |
||||||
|
.github/ |
||||||
|
.vscode/ |
||||||
|
TODO |
||||||
|
book/ |
||||||
|
docs/ |
||||||
|
examples/ |
||||||
|
target/ |
||||||
|
tests/ |
@ -0,0 +1,30 @@ |
|||||||
|
FROM rust:1.50.0 AS build |
||||||
|
WORKDIR /usr/src |
||||||
|
|
||||||
|
# Download the target for static linking. |
||||||
|
RUN rustup target add x86_64-unknown-linux-musl |
||||||
|
|
||||||
|
# Create a dummy project and build the app's dependencies. |
||||||
|
# If the Cargo.toml or Cargo.lock files have not changed, |
||||||
|
# we can use the docker build cache and skip these (typically slow) steps. |
||||||
|
WORKDIR /usr/src/sabre |
||||||
|
COPY Cargo.toml Cargo.lock ./ |
||||||
|
|
||||||
|
# Copy the source and build the application. |
||||||
|
COPY src ./src |
||||||
|
COPY lib ./lib |
||||||
|
COPY builtin ./builtin |
||||||
|
RUN cargo install --target x86_64-unknown-linux-musl --path . |
||||||
|
|
||||||
|
RUN cargo build --release |
||||||
|
|
||||||
|
# Copy the statically-linked binary into a scratch container. |
||||||
|
FROM alpine:3.13 |
||||||
|
|
||||||
|
LABEL maintainer="Garrit Franke <garrit@slashdev.space>" |
||||||
|
|
||||||
|
COPY --from=build /usr/local/cargo/bin/sabre /bin |
||||||
|
|
||||||
|
RUN sabre --version |
||||||
|
|
||||||
|
ENTRYPOINT ["sabre"] |
Loading…
Reference in new issue