pneumatube/Dockerfile

30 lines
1.3 KiB
Text
Raw Normal View History

# The build needs the fumi source for the Cargo path dependency
# (../fumi/core), so the build context is the PARENT directory:
# podman build -f pneumatube/Dockerfile ..
# (docker-compose.yml already sets context ".."). Only the source files are
# COPYed explicitly, not the whole directories: the context root is not
# this repo, so a .dockerignore here does not apply, and sibling target/
# and ./data trees must stay out of the image layers.
# The fumi CLI ships in the image too, so account bootstrap needs nothing
# but this image:
# docker compose run --rm pneumatube \
# fumi --key /data/gateway.key --db /data/gateway.db keygen
FROM rust:1-slim-bookworm AS build
WORKDIR /src
COPY fumi/Cargo.toml fumi/Cargo.lock fumi/
COPY fumi/core fumi/core
COPY fumi/cli fumi/cli
COPY pneumatube/Cargo.toml pneumatube/Cargo.lock pneumatube/
COPY pneumatube/src pneumatube/src
WORKDIR /src/pneumatube
RUN cargo build --release --bin pneumatube
RUN cargo build --release --manifest-path ../fumi/Cargo.toml --bin fumi
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /src/pneumatube/target/release/pneumatube /usr/local/bin/pneumatube
COPY --from=build /src/fumi/target/release/fumi /usr/local/bin/fumi
CMD ["pneumatube"]