From f2dc9684eb4b70bf5e8ea9bd1143dce7c1860fc2 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 21 May 2024 13:32:22 -0500 Subject: [PATCH] chore: Add Dockerfile and GitHub Actions workflow for building and releasing fastfetch image --- .../build_and_release_for_fastfetch.yaml | 47 +++++++++++++++++++ fastfetch/Dockerfile | 33 +++++++++++++ fastfetch/Dockerfile.ttyd | 36 ++++++++++++++ fastfetch/README.md | 7 +++ fastfetch/VERSION | 1 + fastfetch/docker-compose.yml | 24 ++++++++++ 6 files changed, 148 insertions(+) create mode 100644 .github/workflows/build_and_release_for_fastfetch.yaml create mode 100644 fastfetch/Dockerfile create mode 100644 fastfetch/Dockerfile.ttyd create mode 100644 fastfetch/README.md create mode 100644 fastfetch/VERSION create mode 100644 fastfetch/docker-compose.yml diff --git a/.github/workflows/build_and_release_for_fastfetch.yaml b/.github/workflows/build_and_release_for_fastfetch.yaml new file mode 100644 index 0000000..f5ab89f --- /dev/null +++ b/.github/workflows/build_and_release_for_fastfetch.yaml @@ -0,0 +1,47 @@ +name: "Build and release for fastfetch" + +on: + push: + branches: + - main + paths: + - "fastfetch/**" + +jobs: + create: + name: "Creates the newest release by version" + runs-on: "ubuntu-latest" + + steps: + - name: Checkout project + uses: actions/checkout@v2.3.4 + + # New step to read the VERSION file and set the version as an output + - name: Get the version + id: get_version + run: echo "fastfetch_version=$(cat fastfetch/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: ./fastfetch + file: ./fastfetch/Dockerfile + tags: | + bigbeartechworld/big-bear-fastfetch:latest + bigbeartechworld/big-bear-fastfetch:${{ env.fastfetch_version }} diff --git a/fastfetch/Dockerfile b/fastfetch/Dockerfile new file mode 100644 index 0000000..7f7f101 --- /dev/null +++ b/fastfetch/Dockerfile @@ -0,0 +1,33 @@ +FROM ubuntu:22.04 + +# Install required packages and add the PPA for fastfetch +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:zhangsongcui3371/fastfetch && \ + apt-get update && \ + apt-get install -y \ + procps \ + curl \ + iproute2 \ + git \ + golang-go \ + vim \ + fastfetch \ + && 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 + +# Expose the port gotty will run on +EXPOSE 7681 + +# Start gotty and run ncdu with the specified path +CMD ["gotty", "-p", "7681", "-w", "fastfetch"] diff --git a/fastfetch/Dockerfile.ttyd b/fastfetch/Dockerfile.ttyd new file mode 100644 index 0000000..003c3d6 --- /dev/null +++ b/fastfetch/Dockerfile.ttyd @@ -0,0 +1,36 @@ +FROM debian:latest + +# Install required packages and add the PPA for fastfetch +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:zhangsongcui3371/fastfetch && \ + apt-get update && \ + apt-get install -y \ + procps \ + curl \ + iproute2 \ + git \ + golang-go \ + vim \ + fastfetch \ + && 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 + +# Expose the port ttyd will run on +EXPOSE 7681 + +# Start ttyd and run btop +CMD ["ttyd", "-p", "7681", "-W", "fastfetch"] diff --git a/fastfetch/README.md b/fastfetch/README.md new file mode 100644 index 0000000..960cdb3 --- /dev/null +++ b/fastfetch/README.md @@ -0,0 +1,7 @@ +# Instructions to build and run the Docker image + +# Build docker image with: + +``` +docker build . -t big-bear-fastfetch +``` diff --git a/fastfetch/VERSION b/fastfetch/VERSION new file mode 100644 index 0000000..8acdd82 --- /dev/null +++ b/fastfetch/VERSION @@ -0,0 +1 @@ +0.0.1 diff --git a/fastfetch/docker-compose.yml b/fastfetch/docker-compose.yml new file mode 100644 index 0000000..0fe997c --- /dev/null +++ b/fastfetch/docker-compose.yml @@ -0,0 +1,24 @@ +version: "3.8" # Specify the version of the Docker Compose file format + +services: + # Define the service named 'big-bear-fastfetch' + big-bear-fastfetch: + # Build the Docker image using the Dockerfile in the current directory + build: . + # Name the container 'big-bear-fastfetch' for easier identification + container_name: big-bear-fastfetch + # 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 + # Map port 7681 on the host to port 7681 on the container + ports: + - "7681:7681"