add containerfile
This commit is contained in:
parent
aeb66e878c
commit
d7f056f77e
2
.containerignore
Normal file
2
.containerignore
Normal file
@ -0,0 +1,2 @@
|
||||
/target
|
||||
Containerfile
|
22
Containerfile
Normal file
22
Containerfile
Normal file
@ -0,0 +1,22 @@
|
||||
FROM docker.io/rust:1-alpine3.19 AS builder
|
||||
|
||||
RUN apk --no-cache add musl-dev
|
||||
|
||||
ENV CARGO_CARGO_NEW_VCS="none"
|
||||
ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
|
||||
|
||||
WORKDIR /work
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --release --target=$(arch)-unknown-linux-musl
|
||||
RUN cp "./target/$(arch)-unknown-linux-musl/release/rusty-library" /app
|
||||
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /app /app
|
||||
CMD ["/app", "--", "/library"]
|
||||
|
||||
VOLUME ["/library"]
|
||||
EXPOSE 3000
|
@ -17,8 +17,8 @@ do but luckily enough it is the part I need for myself.
|
||||
## Nix
|
||||
|
||||
A [nix](https://nixos.org/download/) environment with enabled
|
||||
[nix-commands](https://nixos.org/manual/nix/stable/contributing/experimental-features#xp-feature-nix-command)
|
||||
in order to use `nix develop` and `nix build`.
|
||||
[nix-commands](https://nixos.wiki/wiki/Flakes) in order to use `nix develop` and
|
||||
`nix build`.
|
||||
|
||||
A statically linked binary for linux systems (using
|
||||
[musl](https://musl.libc.org/)) can be compiled by running `nix build` (run
|
||||
|
Loading…
Reference in New Issue
Block a user