diff --git a/.github/workflows/gui-build-test.yml b/.github/workflows/gui-build-test.yml new file mode 100644 index 00000000..2bd723c3 --- /dev/null +++ b/.github/workflows/gui-build-test.yml @@ -0,0 +1,41 @@ +name: GUI Build Test + +on: + pull_request: + workflow_dispatch: + +permissions: + contents: read +jobs: + test-gui-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build the GUI Docker image + run: sudo docker build -t arch-iso-gui -f Dockerfile.gui . + + - name: Run the GUI container + run: sudo docker run --rm --privileged -d -p 8080:8080 --name arch-iso-gui-test -v $(pwd):/workdir arch-iso-gui + + - name: Wait for the server to start + run: sleep 15 + + - name: Trigger ISO build and wait for completion + # This step triggers the build via the API and waits for the "BUILD_SUCCESS" message. + # The build can take a long time, so a generous timeout is set. + run: | + curl -N --max-time 7200 http://localhost:8080/build | tee build.log + grep -q "BUILD_SUCCESS" build.log + + - name: Verify ISO file was created + run: sudo docker exec arch-iso-gui-test test -f /workdir/out/Arch.iso + + - name: Test ISO download endpoint + run: curl -f -I http://localhost:8080/download | grep -q 'Content-Disposition: attachment; filename=Arch.iso' + + - name: Stop the container + if: always() + run: sudo docker stop arch-iso-gui-test diff --git a/Dockerfile.gui b/Dockerfile.gui new file mode 100644 index 00000000..66b266a6 --- /dev/null +++ b/Dockerfile.gui @@ -0,0 +1,40 @@ +# Use the same builder as the original Dockerfile +FROM archlinux:latest AS builder + +# Set up parallel downloads and other optimizations +COPY pacman.conf /etc/pacman.conf + +# Update system and install necessary packages +RUN pacman -Syu --noconfirm && \ + pacman -S --noconfirm --needed \ + git \ + archiso \ + grub \ + base-devel \ + python-flask \ + && pacman -Scc --noconfirm + +# Set the working directory +WORKDIR /build + +# Copy only necessary files for package installation +COPY packages.x86_64 bootstrap_packages.x86_64 profiledef.sh ./ + +# Create a new final image +FROM builder AS final + +# Set the working directory +WORKDIR /workdir + +# Copy the rest of the files +COPY . . + +# Use an entrypoint script for better flexibility +COPY ./scripts/entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Expose the port for the web GUI +EXPOSE 8080 + +# Set the entrypoint to run the Flask application +ENTRYPOINT ["python", "app.py"] diff --git a/README.md b/README.md index 5b28b583..30bb039a 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,55 @@ To install Docker, follow the instructions for your operating system: Once the process completes, the ISO will be available in the `out/` directory within your local folder as `Arch.iso`. +--- + +## How to Build the ISO with a GUI + +For a more user-friendly experience, you can use a Docker container that provides a web-based graphical user interface (GUI) to build the ISO. + +### Prerequisites + +Ensure you have Docker installed and running on your system. + +### Steps to Build with the GUI + +1. **Clone the repository**: + + ```bash + git clone https://github.com/Githubguy132010/Arch-Linux-without-the-beeps.git + cd Arch-Linux-without-the-beeps + ``` + +2. **Build the GUI Docker Image**: + + Build the Docker image for the GUI application. + + ```bash + docker build -t arch-iso-gui -f Dockerfile.gui . + ``` + +3. **Run the GUI Container**: + + Run the container, mapping port 8080 to your host system. + + ```bash + docker run --rm --privileged -p 8080:8080 -v $(pwd):/workdir arch-iso-gui + ``` + +4. **Access the GUI**: + + Open your web browser and navigate to `http://localhost:8080`. + +5. **Build the ISO**: + + Click the "Build ISO" button to start the build process. The logs will be displayed in real-time on the page. + +6. **Download the ISO**: + + Once the build is complete, a download link for `Arch.iso` will appear. + +--- + ## How to Use GitHub Actions (Automated Workflow) This repository also includes a GitHub Actions workflow for building and releasing the ISO automatically on GitHub. diff --git a/app.py b/app.py new file mode 100644 index 00000000..c0841d3c --- /dev/null +++ b/app.py @@ -0,0 +1,45 @@ +import os +import subprocess +from flask import Flask, render_template, Response, send_from_directory + +app = Flask(__name__) +ISO_DIR = "/workdir/out" +ISO_NAME = "Arch.iso" +ISO_PATH = os.path.join(ISO_DIR, ISO_NAME) + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/build') +def build(): + def generate(): + # Ensure the output directory exists + os.makedirs(ISO_DIR, exist_ok=True) + + # Command to execute the build script + command = ["/entrypoint.sh", "build", "out", "work"] + + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, bufsize=1, universal_newlines=True) + + for line in process.stdout: + yield f"data: {line}\n\n" + + process.wait() + + if process.returncode == 0: + yield "data: BUILD_SUCCESS\n\n" + else: + yield "data: BUILD_FAILED\n\n" + + return Response(generate(), mimetype='text/event-stream') + +@app.route('/download') +def download(): + if os.path.exists(ISO_PATH): + return send_from_directory(directory=ISO_DIR, path=ISO_NAME, as_attachment=True) + else: + return "ISO not found.", 404 + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=8080) diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 00000000..b13f8c02 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,60 @@ + + +
+ + +