Skip to content

Commit 5e7256e

Browse files
authored
Merge pull request #18 from ravindu644/docker-testing
Re-wired the docker setup
2 parents 09bf03b + 29b9afc commit 5e7256e

6 files changed

Lines changed: 205 additions & 10 deletions

File tree

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build the Docker Container
1+
name: Build the Docker Container - Full
22

33
on:
44
workflow_dispatch:
@@ -23,19 +23,19 @@ jobs:
2323
2424
- name: Cook the container
2525
run: |
26-
cd docker && bash build-container.sh || exit 1
26+
cd docker && bash build-container-full.sh || exit 1
2727
2828
- name: Upload Artifacts
2929
uses: actions/upload-artifact@v4
3030
with:
31-
name: Kernel-Builder-${{ github.event.inputs.tag }}
31+
name: Kernel-Builder-${{ github.event.inputs.tag }}-full
3232
path: docker/*.zip
3333

3434
- name: Create release
3535
uses: ncipollo/release-action@v1
3636
with:
3737
tag: ${{ github.event.inputs.tag }}-docker
38-
name: "Kernel-Builder-${{ github.event.inputs.tag }}"
38+
name: "Kernel-Builder-${{ github.event.inputs.tag }}-full"
3939
draft: false
4040
prerelease: true
4141
token: ${{ secrets.TOKEN }}
@@ -45,10 +45,14 @@ jobs:
4545
4646
- Download the `kernel-builder.zip` file.
4747
- Unzip it.
48-
- Install Docker if it's not already installed.
49-
- Run `kernel-builder.sh`, which is located inside the unzipped folder to power up the docker container :)
48+
- Install Docker if it's not already installed.
49+
- In Ubuntu based systems, you can run:
5050
5151
```
52-
bash kernel-builder.sh
53-
```
52+
sudo apt install docker.io && sudo usermod -aG docker $USER && sudo reboot
53+
```
54+
- Run `kernel-builder.sh`, which is located inside the unzipped folder to power up the docker container :)
5455
56+
```
57+
sudo ./kernel-builder.sh
58+
```
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build the Docker Container - Minimal
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Docker Release Tag'
8+
required: true
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-22.04
13+
14+
steps:
15+
- name: Checkout source
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
20+
- name: Set environment variable
21+
run: |
22+
echo "DOCKER_CONTAINER_VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
23+
24+
- name: Cook the container
25+
run: |
26+
cd docker && bash build-container-minimal.sh || exit 1
27+
28+
- name: Upload Artifacts
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: Kernel-Builder-${{ github.event.inputs.tag }}-minimal
32+
path: docker/*.zip
33+
34+
- name: Create release
35+
uses: ncipollo/release-action@v1
36+
with:
37+
tag: ${{ github.event.inputs.tag }}-docker
38+
name: "Kernel-Builder-${{ github.event.inputs.tag }}-minimal"
39+
draft: false
40+
prerelease: true
41+
token: ${{ secrets.TOKEN }}
42+
artifacts: "docker/*.zip"
43+
body: |
44+
**How to use..?**
45+
46+
- Download the `kernel-builder.zip` file.
47+
- Unzip it.
48+
- Install Docker if it's not already installed.
49+
- In Ubuntu based systems, you can run:
50+
51+
```
52+
sudo apt install docker.io && sudo usermod -aG docker $USER && sudo reboot
53+
```
54+
- Run `kernel-builder.sh`, which is located inside the unzipped folder to power up the docker container :)
55+
56+
```
57+
sudo ./kernel-builder.sh
58+
```
59+
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/bin/bash
22

3+
set -x
4+
35
if [ -z "$DOCKER_CONTAINER_VERSION" ]; then
46
export DOCKER_CONTAINER_VERSION="dev"
57
fi
68

9+
cd full
10+
711
# build the container
812
docker build -t kernel-builder .
913

@@ -13,7 +17,8 @@ docker save -o kernel-builder.tar kernel-builder
1317
# xz compressing
1418
xz -z -T0 -9 kernel-builder.tar
1519

16-
mkdir -p "kernel-builder-${DOCKER_CONTAINER_VERSION}" && mv kernel-builder.tar.xz kernel-builder.sh "kernel-builder-${DOCKER_CONTAINER_VERSION}"
20+
mkdir -p "kernel-builder-${DOCKER_CONTAINER_VERSION}" && mv kernel-builder.tar.xz ../kernel-builder.sh "kernel-builder-${DOCKER_CONTAINER_VERSION}"
1721

1822
# zipping stuffs
19-
zip -0 -R "kernel-builder-${DOCKER_CONTAINER_VERSION}.zip" "kernel-builder-${DOCKER_CONTAINER_VERSION}"
23+
zip -0 -r "kernel-builder-${DOCKER_CONTAINER_VERSION}.zip" "kernel-builder-${DOCKER_CONTAINER_VERSION}"
24+
mv *.zip ../

‎docker/build-container-minimal.sh‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
if [ -z "$DOCKER_CONTAINER_VERSION" ]; then
6+
export DOCKER_CONTAINER_VERSION="dev"
7+
fi
8+
9+
cd minimal
10+
11+
# build the container
12+
docker build -t kernel-builder .
13+
14+
# export it as a tar file
15+
docker save -o kernel-builder.tar kernel-builder
16+
17+
# xz compressing
18+
xz -z -T0 -9 kernel-builder.tar
19+
20+
mkdir -p "kernel-builder-${DOCKER_CONTAINER_VERSION}-minimal" && mv kernel-builder.tar.xz ../kernel-builder.sh "kernel-builder-${DOCKER_CONTAINER_VERSION}-minimal"
21+
22+
# zipping stuffs
23+
zip -0 -r "kernel-builder-${DOCKER_CONTAINER_VERSION}-minimal.zip" "kernel-builder-${DOCKER_CONTAINER_VERSION}-minimal"
24+
mv *.zip ../
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ RUN apt-get update && apt-get install -y \
1111
android-sdk-libsparse-utils \
1212
bash-completion \
1313
bc \
14+
tmux \
1415
bison \
1516
build-essential \
1617
bzip2 \
18+
neofetch \
1719
coreutils \
1820
cpio \
1921
curl \

‎docker/minimal/Dockerfile‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Use Ubuntu 22.04 as base image
2+
FROM ubuntu:22.04
3+
4+
# Set environment variables
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
ENV KBUILD_BUILD_USER="@ravindu644"
7+
8+
# Install all required packages
9+
RUN apt-get update && apt-get install -y \
10+
android-sdk-libsparse-utils \
11+
bash-completion \
12+
bc \
13+
tmux \
14+
bison \
15+
build-essential \
16+
bzip2 \
17+
neofetch \
18+
coreutils \
19+
cpio \
20+
curl \
21+
default-jdk \
22+
device-tree-compiler \
23+
e2fsprogs \
24+
erofs-utils \
25+
f2fs-tools \
26+
file \
27+
findutils \
28+
flex \
29+
g++ \
30+
gcc \
31+
git \
32+
gnupg \
33+
gperf \
34+
grep \
35+
iproute2 \
36+
iputils-ping \
37+
kmod \
38+
libarchive-tools \
39+
libc6-dev \
40+
libelf-dev \
41+
libgl1 \
42+
libgl1-mesa-dev \
43+
libncurses-dev \
44+
libreadline-dev \
45+
libssl-dev \
46+
libx11-dev \
47+
libxml2-utils \
48+
lz4 \
49+
make \
50+
nano \
51+
net-tools \
52+
openssl \
53+
openjdk-17-jdk \
54+
p7zip-full \
55+
pahole \
56+
procps \
57+
python-is-python3 \
58+
python3 \
59+
python3-markdown \
60+
repo \
61+
sudo \
62+
tar \
63+
tofrodos \
64+
unzip \
65+
util-linux \
66+
vim \
67+
wget \
68+
xsltproc \
69+
xz-utils \
70+
zip \
71+
zlib1g-dev \
72+
zstd \
73+
--fix-missing && \
74+
wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
75+
dpkg -i libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
76+
rm libtinfo5_6.3-2ubuntu0.1_amd64.deb && \
77+
apt-get full-upgrade -y && \
78+
apt-get clean && \
79+
rm -rf /var/lib/apt/lists/*
80+
81+
# Create the user and set up passwordless sudo
82+
RUN useradd -m -s /bin/bash kernel-builder && \
83+
echo "kernel-builder:kernel-builder" | chpasswd && \
84+
adduser kernel-builder sudo && \
85+
echo "kernel-builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/kernel-builder
86+
87+
# Set the working directory to the kernel-builder's home
88+
WORKDIR /home/kernel-builder
89+
90+
# Add a custom greeting to the bash prompt
91+
RUN echo 'echo -e "\e[32mAndroid-Kernel-Tutorials by @ravindu644\e[0m\n"' >> /home/kernel-builder/.bashrc
92+
93+
# Set the default user to "kernel-builder"
94+
USER kernel-builder
95+
96+
# Init android-partition-tools
97+
RUN git clone https://github.com/ravindu644/android-partition-tools.git /home/kernel-builder/android-partition-tools --depth=1
98+
ENV PATH=$PATH:/home/kernel-builder/android-partition-tools
99+
100+
# Final command to keep the container running
101+
CMD ["bash"]

0 commit comments

Comments
 (0)