-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build sudo-rs outside of the docker container
This significantly reduces the size of the container.
- Loading branch information
Showing
4 changed files
with
38 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
FROM rust:1-slim-bookworm | ||
FROM debian:bookworm-slim | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends clang libclang-dev libpam0g-dev procps sshpass rsyslog | ||
# cache the crates.io index in the image for faster local testing | ||
RUN cargo search sudo | ||
apt-get install -y --no-install-recommends procps sshpass rsyslog | ||
WORKDIR /usr/src/sudo | ||
COPY . . | ||
RUN --mount=type=cache,target=/usr/src/sudo/target cargo build --locked --features="dev" --bins && mkdir -p build && cp target/debug/sudo build/sudo && cp target/debug/su build/su && cp target/debug/visudo build/visudo | ||
COPY target/build build | ||
# set setuid on install | ||
RUN install --mode 4755 build/sudo /usr/bin/sudo | ||
RUN install --mode 4755 build/su /usr/bin/su | ||
RUN install --mode 755 build/visudo /usr/sbin/visudo | ||
# `apt-get install sudo` creates this directory; creating it in the image saves us the work of creating it in each compliance test | ||
RUN mkdir -p /etc/sudoers.d | ||
# remove build dependencies | ||
RUN apt-get autoremove -y clang libclang-dev | ||
# set the default working directory to somewhere world writable so sudo / su can create .profraw files there | ||
WORKDIR /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,4 @@ | |
* | ||
|
||
# but these | ||
!Cargo.lock | ||
!Cargo.toml | ||
!src/**/* | ||
!bin/**/* | ||
!build.rs | ||
!/target/build |