From 213f56a9d423d4784dda97d07e7e72f59246f11b Mon Sep 17 00:00:00 2001 From: Arian Baishya Date: Wed, 14 Feb 2024 11:54:17 -0600 Subject: [PATCH] improve README, update MAKEFILE, add TODO to Dockerfile, and add SHA tag to CI-built images --- .github/workflows/ci.yml | 1 + Dockerfile | 1 + Makefile | 9 ++++----- README.md | 36 ++++++++++++++++++++++++++++++------ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6119fdc..0cac0b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} + type=sha - name: Build and push Docker image uses: docker/build-push-action@v5.1.0 diff --git a/Dockerfile b/Dockerfile index a322335..c7f4a87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ ARG BASE_IMAGE=python ARG BASE_IMAGE_TAG=3.9.18-bullseye +#ARG BASE_IMAGE_TAG=3.9-bookworm # TODO: update base image to newer debian ##### Build Wheels ##### FROM $BASE_IMAGE:$BASE_IMAGE_TAG as builder_wheels diff --git a/Makefile b/Makefile index 76cc689..4b11382 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ -build: +docker_build: docker build . -t ghcr.io/arian04/pytas:latest -run: - # This is a bad way to run an appplication honestly, but I'm working on improving it - xhost +SI:localuser:$(id -un) - docker run --rm --name PyTAS --ipc=host --user $(id -u):$(id -g) --volume=/tmp/.X11-unix/:/tmp/.X11-unix/ -e DISPLAY -e XAUTHORITY ghcr.io/arian04/pytas:latest +docker_run: + xhost +SI:localuser:$USER + docker run --rm --ipc=host --user $UID:$GID --volume=/tmp/.X11-unix/:/tmp/.X11-unix/ -e DISPLAY -e XAUTHORITY ghcr.io/arian04/pytas:latest diff --git a/README.md b/README.md index b398d5a..66b217e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,34 @@ -Run PyTAS through Docker +# Run PyTAS easily + +## What is PyTAS? +Information about PyTAS can be found here: http://self-assembly.net/wiki/index.php/PyTAS + +## What's the purpose of this repo? +I had a few issues running PyTAS. Firstly, it's a bit old. The newest Python version I could use to run +it was 3.9, which isn't too bad, but I also had to pin the dependencies to pretty old versions. +I wouldn't mind if that was all, but installing wxPython involved building wxWidgets, which not +only took a decent amount of time on my reasonably powerful system, it also repeatedly failed due to +missing build dependencies that wouldn't become satisfied even though I carefully made sure I had every +dependency required by the wxWidgets documentation. This repo is meant to help distribute it in a more +painless, portable manner. + +## Methods of running + +### Docker +I believe there are some negative security implications of this, but if you trust the image, then giving +it access to your X server should be fine. + +```sh +# Make sure $USER is properly set in your user shell, and that $UID and $GID aren't set to root's values when you `sudo` a command + +xhost +SI:localuser:$USER # allows your current local user to connect to the X server +sudo docker run --rm --ipc=host --user $UID:$GID --volume=/tmp/.X11-unix/:/tmp/.X11-unix/ -e DISPLAY -e XAUTHORITY ghcr.io/arian04/pytas:latest # runs the container in such a way that it can access the X server, deletes container on exit +``` TODO: -- add more methods of installation - - some method that just builds a static (ish) binary. maybe pyinstaller - - nix? +- add more methods of running + - Use Pyoxidizer to build a portable binary + - [nix](https://nixos.org/)? - improve my current WIP method of running the GUI through Docker - -Information about PyTAS can be found here: http://self-assembly.net/wiki/index.php/PyTAS + or just remove it if Pyoxidizer builds reliable binaries