FROM rust:1.93-slim-trixie@sha256:c0a38f5662afdb298898da1d70b909af4bda4e0acff2dc52aea6360a9b9c6956 AS builder
LABEL MAINTAINER="Richard Zak <richard@malwaredb.net>"
LABEL org.opencontainers.image.authors=richard@malwaredb.net
LABEL SOURCE="https://github.com/malwaredb/malwaredb-rs"
LABEL org.opencontainers.image.source=https://github.com/malwaredb/malwaredb-rs
# Install the libmagic dev package so we can link against it, and git so the binary gets the git info for the version
RUN apt-get update && apt-get install -y libmagic-dev git
WORKDIR /malwaredb
COPY . .
COPY .git/ .
# Add `--features=admin,sqlite,vt,yara` for admin, sqlite support, VirusTotal, Yara feature(s).
# Any, some, or no features are required.
# Without the admin feature, another binary with admin is needed for initial configuration.
RUN cargo install cargo-auditable && cargo auditable build --release --features=vt,yara && cp target/release/mdb_server . && cargo clean
FROM debian:trixie-slim@sha256:1d3c811171a08a5adaa4a163fbafd96b61b87aa871bbc7aa15431ac275d3d430
RUN apt-get update && apt-get install -y libmagic1
WORKDIR /malwaredb
COPY --from=builder /malwaredb/mdb_server /malwaredb
# If running Malware DB from a config file.
# If using TLS, this is where the certificate and private key would reside.
RUN mkdir /malwaredb/config
VOLUME /malwaredb/config
# Storage for saved samples.
RUN mkdir /malwaredb/samples
VOLUME /malwaredb/samples
# Start MalwareDB
CMD ["./mdb_server"]
STOPSIGNAL SIGINT
EXPOSE 8080/tcp