generated from lucas/rust-template
Add Dockerfile
This commit is contained in:
parent
f5c64b788f
commit
c105ac80cd
3 changed files with 32 additions and 0 deletions
1
.dockerignore
Normal file
1
.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
target/
|
|
@ -17,3 +17,7 @@ tokio = { version = "1.40.0", features = ["rt", "sync"] }
|
|||
tracing = "0.1.40"
|
||||
tracing-error = "0.2.0"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
lto = true
|
||||
|
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
|||
FROM rust:1.81.0-slim AS build
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
RUN set -ex; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
make \
|
||||
libluajit-5.1-dev \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
COPY . /src
|
||||
RUN --mount=type=cache,id=cargo-registry,target=/cargo/registry \
|
||||
--mount=type=cache,id=cargo-target,target=/src/target \
|
||||
cargo build --release --locked && cp /src/target/release/ntfy-collector /src/;
|
||||
|
||||
FROM gcr.io/distroless/cc-debian12 AS final
|
||||
|
||||
WORKDIR /ntfy-collector
|
||||
ENV CONFIG_PATH=/ntfy-collector/lua/config.lua
|
||||
ENV LUA_PATH=/ntfy-collector/lua/?.lua;/ntfy-collector/lua/?/init.lua
|
||||
|
||||
COPY --from=build /src/ntfy-collector /usr/bin/ntfy-collector
|
||||
COPY ./lua ./lua
|
||||
|
||||
CMD ["/usr/bin/ntfy-collector"]
|
Loading…
Add table
Reference in a new issue