-
-
Save alexlib/481623e77effef7d7be979f1f832e7cc to your computer and use it in GitHub Desktop.
Revisions
-
Moosems revised this gist
May 23, 2023 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,6 +31,9 @@ RUN sudo apt-get update && apt-get install -y \ # Install the dependencies RUN pip install --upgrade pip; \ pip3 install -r requirements.txt # Create /.local directory RUN mkdir /.local; mkdir /.local/share; chmod 777 /.local; chmod 777 /.local/share # Set the display port to avoid crash and to be able to use the container with a remote host ENV DISPLAY=:0 -
Moosems revised this gist
May 23, 2023 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ # Get the path to the user data directory dir = Path(user_data_dir()) / "HelloWorld" # Create the directory dir.mkdir(parents=True) root.mainloop() -
Moosems revised this gist
May 23, 2023 . No changes.There are no files selected for viewing
-
Moosems created this gist
May 23, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ FROM ubuntu:20.04 as builder FROM python:3.10.7 # Create a user to run the application RUN apt-get update && \ apt-get -y install sudo RUN useradd -ms /bin/bash docker && echo "docker:docker" | chpasswd && adduser docker sudo # Allow sudo without password (add docker user to sudoers) RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers # Switch to the docker user USER docker # Become root USER root # Set the working directory for the container WORKDIR /home/docker COPY . . # Install PIL and tk dependencies RUN sudo apt-get install apt-utils RUN sudo apt-get update && apt-get install -y \ python3-pil \ python3-tk \ python3-pil.imagetk # Install the dependencies RUN pip install --upgrade pip; \ pip3 install -r requirements.txt # Set the display port to avoid crash and to be able to use the container with a remote host ENV DISPLAY=:0 # Run the application CMD ["python3", "main.py"] This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # Build the image docker build -t dip . # # Get IP address of Mac IP=$(/usr/sbin/ipconfig getifaddr en0) # # Print IP address echo "IP: $IP" # # Allow connections through XQuartz /opt/X11/bin/xhost + "$IP" # Run the container docker run -u=$(id -u $USER):$(id -g $USER) -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix:rw --rm -it dip This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ from tkinter import Tk, Label from platformdirs import user_data_dir from pathlib import Path root = Tk() root.title("Hello World") root.geometry("400x200") Label(root, text="Hello World").pack() # Get the path to the user data directory dir = Path(user_data_dir()) / "HelloWorld" # Create the directory if it doesn't exist dir.mkdir(parents=True, exist_ok=True) root.mainloop() This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ platformdirs