Files
kumomta/docker/kumod/Dockerfile
T
Wez Furlong c2cb5b798b fix centos7 build, adjust docker to use /opt/kumomta
Revert building static/bundled sqlite, as the logic deep in sqlite3-src
makes no attempt to deal with this mess on centos7:

  = note: /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /__w/kumomta/kumomta/target/release/deps/libsqlite3_src-b3c44e6f34aac065.rlib(sqlite3.o):(.data.rel.aSyscall+0xb0): undefined reference to `fcntl64'
          collect2: error: ld returned 1 exit status

(I don't blame it!)

Deal with that in the docker image by simply installing sqlite
in the docker image.

And since I'm touching the docker stuff, adjust its install
path and layout to match that of the rpm and deb packages.
2023-03-14 14:14:37 -07:00

46 lines
1.6 KiB
Docker

# Using <https://github.com/LukeMathWalker/cargo-chef> to help cache
# the rust dependencies and make rebuilds go faster
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
RUN apt update
# Needed for building rocksdb
RUN apt install -y libclang-dev
WORKDIR /app
FROM chef as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
COPY --from=planner /app/recipe.json recipe.json
# Build the dependencies and cache them in a layer
RUN cargo chef cook --release --recipe-path recipe.json
# and now build our first-party stuff
COPY . .
RUN cargo build --release -p kumod && cargo build --release -p traffic-gen
# Using Ubuntu rather than alpine because rocksdb, a C++ library,
# is problematic when built with musl.
# <https://github.com/rust-rocksdb/rust-rocksdb/issues/174>.
# It does compile, but it just SEGV'd on startup for me.
FROM ubuntu:latest as runtime
# Create a user and group to run as.
# Note that we don't use the docker USER here because we need to
# start as root and then drop to this user. That is handled by
# the docker-runner.sh script.
RUN groupadd --system --gid 1000 kumod && useradd --system --gid kumod --uid 1000 kumod
RUN apt update && apt install -y libsqlite3-dev
WORKDIR /opt/kumomta/sbin
COPY --from=builder /app/target/release/kumod .
COPY --from=builder /app/target/release/traffic-gen .
COPY docker/kumod/docker-runner.sh .
WORKDIR /opt/kumomta/bounce_classifier
COPY assets/bounce_classifier/*.toml .
EXPOSE 25/tcp
EXPOSE 587/tcp
EXPOSE 465/tcp
EXPOSE 2525/tcp
EXPOSE 2026/tcp
CMD ["/opt/kumomta/sbin/docker-runner.sh"]