From 7e5432260d7daf27e30a4eed0b067eee6531ed54 Mon Sep 17 00:00:00 2001 From: "Git Commiter for 96-fromsofia.net" <2a9-7cc@96-fromsofia.net> Date: Mon, 27 Feb 2023 01:39:33 +0000 Subject: [PATCH] First commit --- Dockerfile | 24 ++++++++++++++++++++++++ README.txt | 29 +++++++++++++++++++++++++++++ start-pass | 11 +++++++++++ xcookie | 2 ++ 4 files changed, 66 insertions(+) create mode 100644 Dockerfile create mode 100644 README.txt create mode 100755 start-pass create mode 100644 xcookie diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d2ff6c5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Get the latest alpine build +FROM alpine:latest + +# Copy the xcookie to your container to use for your X session +# This line can be removed if not intended to be used on Desktop with GUI +COPY xcookie /tmp/ + +# Add the necessary packages +# Can remove xauth, st, xclid and ttf-liberation if not intended to be used on Desktop with GUI +RUN apk add xauth st xclip gnupg pass ttf-liberation + +# Add the user to start your app +# Can skip adding your user to the video group if not intended to be used on Desktop with GUI +RUN adduser pass -D ; addgroup pass pass ; addgroup pass video + +# Add the xcookie to the session of the user we just created +RUN su -c "xauth add $(cat /tmp/xcookie)" pass + +# Use the user we just configured +USER pass + +# Start it all +# This line can be chanhed to: 'CMD /bin/sh' if not intended to be used on Desktop with GUI +CMD st diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..eedbf09 --- /dev/null +++ b/README.txt @@ -0,0 +1,29 @@ +# 1) Go into the source directory of this app 'pass' and copy it into your docker environment: +# You can use your own path but will need to adjust the below lines and any affected dependant files accordingly +$ cp . /var/lib/docker/configs/pass/ +$ cd /var/lib/docker/configs/pass/ + +# 2) Configure the host environment for the container before starting it +# - If intended to be used on Desktop as GUI: +# *) run 'xauth list' on the Docker host as the user that will run the container (not root, unless root runs X on your system) +# *) copy the whole line that was produced by the above command and save it into the xcookie in the source directory of this app +# - If not intended to be run in GUI: +# *) remove the xcookie file from the source directory of this app +# *) edit the Docker file accordingly (see comments in Dockerfile) +# *) remove the below lines from the 'start-pass' script found in the source directory of this app +# -v /tmp/.X11-unix \ +# -e DISPLAY=$DISPLAY \ + +# 3) Build your container +$ docker build -t . pass + +# 4) Create the below directories within /var/lib/docker/configs/pass/data +# If using a different path to store your containers configurations and data files you will need to modify the paths in the 'start-pass' script too +$ mkdir -p /var/lib/docker/configs/pass/data/{gnupg,password-store} + +# 5) Start your container with: +$ start-pass + +# 6) Optionally you can move the start-pass script somewhere inside of your path +$ sudo cp start-pass /usr/loca/bin +$ sudo chmod -v 0755 /usr/loca/bin/start-pass diff --git a/start-pass b/start-pass new file mode 100755 index 0000000..27e9929 --- /dev/null +++ b/start-pass @@ -0,0 +1,11 @@ +docker run --rm -it \ + --memory "512m" \ + --cpus ".5" \ + --net=host \ + # the below line can be removed if not intended to be used on Desktop + -v /tmp/.X11-unix \ + -v /var/lib/docker/configs/pass/data/gnupg:/home/pass/.gnupg \ + -v /var/lib/docker/configs/pass/data/password-store:/home/pass/.password-store \ + # the below line can be removed if not intended to be used on Desktop + -e DISPLAY=$DISPLAY \ + pass diff --git a/xcookie b/xcookie new file mode 100644 index 0000000..139597f --- /dev/null +++ b/xcookie @@ -0,0 +1,2 @@ + +