This commit is contained in:
nora 2023-08-31 20:58:24 +02:00
parent 7ff9a67148
commit 64f5757298
2 changed files with 29 additions and 0 deletions

28
Containerfile Normal file
View file

@ -0,0 +1,28 @@
FROM docker.io/library/rust:1.72 as build
RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get update
RUN apt-get install musl-tools -y
WORKDIR /app
COPY Cargo.toml Cargo.lock rust-toolchain.toml ./
RUN mkdir src
RUN echo "fn main() {}" > src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl
COPY . .
# now rebuild with the proper main
RUN touch src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl
### RUN
FROM gcr.io/distroless/static-debian12
WORKDIR /app
COPY --from=build /app/target/release/x86_64-unknown-linux-musl/uptime uptime
CMD ["/app/uptime"]