-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add Dockerfile and GitHub Actions workflow for building and re…
…leasing ncdu image
- Loading branch information
1 parent
8fe09f9
commit a66716d
Showing
6 changed files
with
152 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Build and release for ncdu" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "ncdu/**" | ||
|
||
jobs: | ||
create: | ||
name: "Creates the newest release by version" | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout project | ||
uses: actions/[email protected] | ||
|
||
# New step to read the VERSION file and set the version as an output | ||
- name: Get the version | ||
id: get_version | ||
run: echo "ncdu_version=$(cat ncdu/VERSION)" >> $GITHUB_ENV | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@master | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker Build | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
context: ./ncdu | ||
file: ./ncdu/Dockerfile | ||
tags: | | ||
bigbeartechworld/big-bear-ncdu:latest | ||
bigbeartechworld/big-bear-ncdu:${{ env.ncdu_version }} |
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 @@ | ||
FROM debian:latest | ||
|
||
# Install required packages | ||
RUN apt-get update && apt-get install -y \ | ||
ncdu \ | ||
procps \ | ||
curl \ | ||
iproute2 \ | ||
git \ | ||
golang-go \ | ||
vim \ | ||
&& apt-get clean | ||
|
||
# Clone, build, and install gotty | ||
RUN git clone https://github.com/sorenisanerd/gotty.git /tmp/gotty && \ | ||
cd /tmp/gotty && \ | ||
go build && \ | ||
mv gotty /usr/local/bin/ && \ | ||
cd / && \ | ||
rm -rf /tmp/gotty | ||
|
||
# Set the terminal to support UTF-8 | ||
ENV LANG C.UTF-8 | ||
|
||
# Define the NCDU_PATH environment variable with a default value | ||
ENV NCDU_PATH / | ||
|
||
# Expose the port gotty will run on | ||
EXPOSE 7681 | ||
|
||
# Start gotty and run ncdu with the specified path | ||
CMD ["gotty", "-p", "7681", "-w", "ncdu", "$NCDU_PATH"] |
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,38 @@ | ||
FROM debian:latest | ||
|
||
# Install required packages for building ttyd and running btop | ||
RUN apt-get update && apt-get install -y \ | ||
ncdu \ | ||
procps \ | ||
curl \ | ||
iproute2 \ | ||
git \ | ||
cmake \ | ||
g++ \ | ||
pkg-config \ | ||
libjson-c-dev \ | ||
libwebsockets-dev \ | ||
&& apt-get clean | ||
|
||
# Clone, build, and install ttyd | ||
RUN git clone https://github.com/tsl0922/ttyd.git /tmp/ttyd && \ | ||
cd /tmp/ttyd && \ | ||
mkdir build && \ | ||
cd build && \ | ||
cmake .. && \ | ||
make && \ | ||
make install && \ | ||
cd / && \ | ||
rm -rf /tmp/ttyd | ||
|
||
# Set the terminal to support UTF-8 | ||
ENV LANG C.UTF-8 | ||
|
||
# Define the NCDU_PATH environment variable with a default value | ||
ENV NCDU_PATH / | ||
|
||
# Expose the port ttyd will run on | ||
EXPOSE 7681 | ||
|
||
# Start ttyd and run btop | ||
CMD ["ttyd", "-p", "7681", "-W", "ncdu", "$NCDU_PATH"] |
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,7 @@ | ||
# Instructions to build and run the Docker image | ||
|
||
# Build docker image with: | ||
|
||
``` | ||
docker build . -t big-bear-ncdu | ||
``` |
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 @@ | ||
0.0.1 |
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,27 @@ | ||
version: "3.8" # Specify the version of the Docker Compose file format | ||
|
||
services: | ||
# Define the service named 'big-bear-ncdu' | ||
big-bear-ncdu: | ||
# Build the Docker image using the Dockerfile in the current directory | ||
build: . | ||
# Name the container 'big-bear-ncdu' for easier identification | ||
container_name: big-bear-ncdu | ||
# Run the container in privileged mode to allow access to system metrics | ||
privileged: true | ||
# Mount necessary volumes for accessing system information | ||
volumes: | ||
# Mount the host's /proc directory to the container's /proc directory | ||
- /proc:/proc | ||
# Mount the host's /sys directory to the container's /sys directory | ||
- /sys:/sys | ||
# Mount the host's /dev directory to the container's /dev directory | ||
- /dev:/dev | ||
# Mount the host's /etc/localtime file to the container's /etc/localtime file (read-only) | ||
- /etc/localtime:/etc/localtime:ro | ||
# Set environment variables for the container | ||
environment: | ||
- NCDU_PATH=/ | ||
# Map port 7681 on the host to port 7681 on the container | ||
ports: | ||
- "7681:7681" |