server: Add Containerfile

The SSHCA server is intended to be run in a Kubernetes container.
Dustin 2023-11-08 21:12:40 -06:00
parent 47ba62f208
commit 4610e9df33
2 changed files with 34 additions and 0 deletions

5
server/.containerignore Normal file
View File

@ -0,0 +1,5 @@
*
!src/
!examples/
!Cargo.toml
!Cargo.lock

29
server/Containerfile Normal file
View File

@ -0,0 +1,29 @@
FROM registry.fedoraproject.org/fedora:38 AS build
RUN --mount=type=cache,target=/var/cache \
dnf install -y \
--setopt install_weak_deps=0 \
cargo \
libvirt-devel \
rust \
&& :
COPY . /build
RUN cd /build && cargo build --release --bins && strip -s target/release/sshca
FROM registry.fedoraproject.org/fedora-minimal:38
RUN --mount=type=cache,target=/var/cache \
microdnf install -y \
--setopt install_weak_deps=0 \
tini \
libvirt-libs \
openssh-clients \
&& :
COPY --from=build /build/target/release/sshca /usr/local/bin/sshca
USER 298:298
ENTRYPOINT ["tini", "/usr/local/bin/sshca", "--"]