diff --git a/Dockerfile b/Dockerfile index 3388bee..3cd979d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # Use the official Python slim image FROM python:3.11-slim +USER root + # Install system dependencies including Tkinter, Xvfb, and X11 utilities RUN apt update && apt install -y \ git \ @@ -21,7 +23,7 @@ RUN apt update && apt install -y \ fluxbox \ && rm -rf /var/lib/apt/lists/* - +# Set working directory WORKDIR /app RUN mkdir ~/.vnc @@ -29,25 +31,22 @@ RUN x11vnc -storepasswd 1234 ~/.vnc/passwd COPY . . - -RUN pip install --no-cache-dir \ +# Install Python dependencies +RUN pip install --break-system-packages --no-cache-dir \ pyyaml \ pysnmp \ - pysnmp_sync_adapter \ tkcalendar \ pyperclip \ black \ tomli \ - text-console + text-console \ + pysnmp_sync_adapter # Set the DISPLAY environment variable for Xvfb ENV DISPLAY=:99 -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Expose the VNC port EXPOSE 5990 # Set the entrypoint to automatically run the script -ENTRYPOINT ["/start.sh"] +ENTRYPOINT ["bash", "/app/start.sh"] diff --git a/README.md b/README.md index 2269f72..0ee1f19 100644 --- a/README.md +++ b/README.md @@ -62,33 +62,6 @@ The software also includes a configurable printer dictionary, which can be easil Note on the ink waste counter reset feature: resetting the ink waste counter is just removing a lock; not replacing the tank will reduce the print quality and make the ink spill. -## Install-2-go (macOS) -Prerequirements: Docker, TigerVNC - -### 1. Install Tiger VNC Viewer - -```bash -brew install tigervnc-viewer -``` - -### 2. Download Docker Image - -```bash -docker pull mvoreakou/epson-god-mode:latest -``` - -### 3. App run -```bash -docker run --rm --publish 5990:5990 --env HOME=/ mvoreakou/epson-god-mode x11vnc -usepw -create -``` -### 4. Open GUI -Open tiger VNC that was installed on your mac, and fill - -`VNC server:` `localhost:5990` - -Click `Connect` & voila! - - ## Installation Install requirements using *requirements.txt*: @@ -138,6 +111,46 @@ optional arguments: epson_print_conf GUI ``` +## Quick Start on macOS via Docker + +Prerequirements: Docker, a VNC client (e.g. TigerVNC, RealVNC, Remmina) + +To install TigerVNC Viewer via Homebrew: + +```bash +brew install --cask tigervnc-viewer +``` + +Build the Docker Image: + +```bash +git clone https://github.com/Ircama/epson_print_conf +cd epson_print_conf +sudo docker build -t epson_print_conf . +``` + +Run the Container: + +```bash +sudo docker run -p 5990:5990 epson_print_conf +``` + +or + +``` +sudo docker run --publish 5990:5990 ircama/epson_print_conf +``` + +Open your VNC client and connect: + +```bash +vncviewer localhost:90 +``` + +(Password: 1234). + +## Usage notes + ### How to import an external printer configuration DB With the GUI, the following operations are possible (from the file menu): diff --git a/RELEASES.md b/RELEASES.md index 0333f99..0157c96 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -37,3 +37,12 @@ git ls-remote --tags https://github.com/Ircama/epson_print_conf # list remote ta ``` Then follow the tagging procedure again to add the tag to the latest commit. + +# Pushing the docker container + +```shell +sudo docker login +sudo docker buildx build --platform linux/amd64,linux/arm64 -t ircama/epson_print_conf --push . + +sudo docker run --publish 5990:5990 ircama/epson_print_conf +``` diff --git a/start.sh b/start.sh index a94f38a..ec43a9e 100644 --- a/start.sh +++ b/start.sh @@ -1,4 +1,12 @@ #!/bin/bash +set -e + +# Update repo at runtime +if [ ! -d /app/.git ]; then + git clone https://github.com/Ircama/epson_print_conf.git /app +else + cd /app && git pull +fi echo "Starting Xvfb virtual display..." Xvfb :99 -screen 0 1280x800x24 & @@ -21,4 +29,4 @@ x11vnc -display :99 -forever -nopw -bg -rfbport 5990 & sleep 2 echo "Starting Tkinter application..." -exec python ui.py +exec python3 ui.py diff --git a/ui.py b/ui.py index dbb7e41..26f3efe 100644 --- a/ui.py +++ b/ui.py @@ -269,11 +269,18 @@ class EpsonPrinterUI(tk.Tk): hostname: str = None, conf_dict = {}, replace_conf=False - ): - super().__init__() + ): + try: + super().__init__() + except Exception as e: + logging.critical("Cannot start program: %s", e) + quit() self.title("Epson Printer Configuration - v" + VERSION) self.geometry("500x500") - self.minsize(550, 600) + if self.call('tk', 'windowingsystem') == "x11": + self.minsize(600, 600) + else: + self.minsize(550, 600) self.printer_scanner = PrinterScanner() self.ip_list = [] self.ip_list_cycle = None