Add container image build script

Dustin 2024-07-28 10:12:17 -05:00
parent da756ff1a4
commit e6d7cf69fa
2 changed files with 41 additions and 0 deletions

38
Containerfile Normal file
View File

@ -0,0 +1,38 @@
FROM docker.io/library/alpine AS build
RUN --mount=type=cache,target=/var/cache \
apk add \
cargo \
protoc \
rust \
&& :
COPY src /src/src
COPY Cargo.* /src/
WORKDIR /src
RUN cargo build --release
FROM docker.io/library/alpine
RUN --mount=type=cache,target=/var/cache \
apk add \
libgcc \
&& :
COPY --from=build /src/target/release/luci /usr/local/bin/luci
COPY dch-root-ca.crt /etc/ssl/certs
COPY nsenter.sh /usr/local/libexec/nsenter.sh
RUN for cmd in \
systemctl \
; do \
ln -s /usr/local/libexec/nsenter.sh /usr/local/bin/${cmd} \
; done
ENTRYPOINT ["luci"]

3
nsenter.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
exec nsenter -t 1 -m -u -i -n -p "${0##*/}" "$@"