-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3e6abb
commit de4a5c9
Showing
15 changed files
with
75 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG image=debian:testing | ||
ARG arch=amd64 | ||
|
||
FROM $arch/$image AS mini_sudo | ||
WORKDIR /tmp | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y gcc libc-dev | ||
COPY mini_sudo.c ./ | ||
RUN gcc -Wall -Werror -static -o sudo mini_sudo.c \ | ||
&& install -m 6755 sudo /usr/local/bin/sudo | ||
|
||
FROM $arch/$image | ||
WORKDIR /tmp | ||
COPY bin /usr/local/bin | ||
RUN mkdir /pkgs \ | ||
&& touch /pkgs/Packages \ | ||
&& echo 'deb [trusted=yes] file:/pkgs /' >> /etc/apt/sources.list \ | ||
&& echo -e 'Package: *\nPin: origin ""\nPin-Priority: 900' > /etc/apt/preferences.d/local-pkgs | ||
COPY pkgs ./ | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y build-essential ca-certificates debhelper devscripts git sudo yq $(awk '{ print $1 }' pkgs) \ | ||
&& apt-mark hold $(awk '{ print $1 }' pkgs) | ||
RUN gcc --print-search-dir \ | ||
&& echo 'int main() { return 0; }' > main.c \ | ||
&& gcc -o main main.c \ | ||
&& ./main | ||
RUN find /tmp -mindepth 1 -delete | ||
COPY --from=mini_sudo /usr/local/bin/sudo /usr/local/bin/sudo | ||
RUN groupadd dev && useradd -m -g dev dev | ||
USER dev | ||
RUN mkdir /home/dev/work | ||
WORKDIR /home/dev/work |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
ARG image=debian:testing | ||
ARG native_arch=amd64 | ||
ARG target_arch=arm64v8 | ||
|
||
FROM $native_arch/$image AS mini_sudo | ||
WORKDIR /tmp | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y gcc libc-dev | ||
COPY mini_sudo.c ./ | ||
RUN gcc -Wall -Werror -static -o sudo mini_sudo.c \ | ||
&& install -m 6755 sudo /usr/local/bin/sudo | ||
|
||
FROM $native_arch/$image AS native | ||
ARG gnu_arch=aarch64 | ||
WORKDIR /tmp | ||
COPY pkg setup_native ./ | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y bbe patchelf $(sed 's/\$arch/'"$gnu_arch"'/' pkgs | awk '{ print $NF }') \ | ||
&& ./setup_native export $(sed 's/\$arch/'"$gnu_arch"'/' pkgs | awk '{ print $NF }') | ||
|
||
FROM $target_arch/$image | ||
WORKDIR /tmp | ||
COPY bin /usr/local/bin | ||
RUN mkdir /pkgs \ | ||
&& touch /pkgs/Packages \ | ||
&& echo 'deb [trusted=yes] file:/pkgs /' >> /etc/apt/sources.list \ | ||
&& echo -e 'Package: *\nPin: origin ""\nPin-Priority: 900' > /etc/apt/preferences.d/local-pkgs | ||
COPY pkgs setup_native ./ | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y build-essential ca-certificates debhelper devscripts git yq $(awk '{ print $1 }' pkgs) \ | ||
&& apt-mark hold $(awk '{ print $1 }' pkgs) | ||
COPY --from=native /native /native | ||
RUN [ "/native/bash", "-c", "PATH=/native:$PATH ./setup_native import $(awk '{ print $1 }' pkgs)" ] | ||
RUN gcc --print-search-dir \ | ||
&& echo 'int main() { return 0; }' > main.c \ | ||
&& gcc -o main main.c \ | ||
&& ./main | ||
RUN find /tmp -mindepth 1 -delete | ||
COPY --from=mini_sudo /usr/local/bin/sudo /usr/local/bin/sudo | ||
RUN groupadd dev && useradd -m -g dev dev | ||
USER dev | ||
RUN mkdir /home/dev/work | ||
WORKDIR /home/dev/work |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.