๐ Web Page | ๐ป Source Code | ๐ Releases
๐ Packages | ๐ณ Docker Hub
๐ logkey
A lightweight Python application to log user inputs into a CSV file with Docker support for easy deployment and GitHub Actions to automate key workflows.

๐ Table of Contents
- ๐ logkey
๐ About
logkey
is a Python-based application that logs user input into a CSV file. Users can configure the exit key and the CSV file name via command-line arguments. By default, the exit key is q
, and the inputs are stored in inputs.csv
.
๐ How to Run?
๐ Without Docker
๐ Clone the Repository
git clone https://github.com/imfsiddiqui/logkey
cd logkey
imfsiddiqui
is the GitHub username.logkey
is the repository name.
๐ฆ Install Dependencies
Ensure Python installed, then run:
pip install -r requirements.txt
โถ๏ธ Run the Application
python app.py --exit-key <key> --csv-file <filename>
- Replace
<key>
with your desired exit key (default isq
). - Replace
<filename>
with your desired CSV file name (default isinputs.csv
).
๐ก Example
python app.py --exit-key x --csv-file user_inputs.csv
This will log inputs to user_inputs.csv
and exit when x
is pressed.
๐ณ With Docker
Ensure Docker installed, then follow the below instructions.
Note
In all the following commands:
imfsiddiqui
is the Docker Hub username.logkey
is the Docker image name.
๐ฅ Pull the Docker Image
Pull the prebuilt Docker image from Docker Hub:
docker pull imfsiddiqui/logkey
โถ๏ธ Run the Application
Use the following command to run the application in a Docker container:
๐ง Linux
docker run -it --rm -v $(pwd)/:/app/data/ imfsiddiqui/logkey \
python app.py --exit-key <key> --csv-file /app/data/<filename>
๐ช Windows: PowerShell
docker run -it --rm -v ${PWD}/:/app/data/ imfsiddiqui/logkey `
python app.py --exit-key <key> --csv-file /app/data/<filename>
- The
-v $(pwd)/:/app/data/
or-v ${PWD}/:/app/data/
option mounts the current working directory from host machine to the/app/data/
directory inside the container. This ensures that any CSV files created or updated by the application are stored persistently on host machine, even after the container stops. - Replace
<key>
with your desired exit key (default isq
). - Replace
<filename>
with your desired CSV file name (default isinputs.csv
).
๐ก Example
๐ง Linux
docker run -it --rm -v $(pwd)/:/app/data/ imfsiddiqui/logkey \
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
๐ช Windows: PowerShell
docker run -it --rm -v ${PWD}/:/app/data/ imfsiddiqui/logkey `
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
This will log inputs to user_inputs.csv
in the current directory on host machine and exit when x
is pressed.
๐ ๏ธ Development
If made any changes to the Python script app.py
or update the requirements.txt
file, follow these steps to rebuild and publish the Docker image.
๐ Update the requirements.txt
File
New dependencies or libraries can be added to the project by adding their name in the requirements.txt
file.
๐๏ธ Build the Docker Image
Rebuild the Docker image to include the latest changes:
๐ง Linux
docker build -t logkey:latest -f ./Dockerfile .
๐ช Windows: PowerShell
docker build -t logkey:latest -f .\Dockerfile .
๐งช Test the Docker Image Locally
Run the updated Docker image locally to ensure everything works as expected:
๐ง Linux
docker run -it --rm -v $(pwd)/:/app/data/ logkey:latest \
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
๐ช Windows: PowerShell
docker run -it --rm -v ${PWD}/:/app/data/ logkey:latest `
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
๐ท๏ธ Tag the Docker Image
Tag the Docker image with a version number or latest
:
docker tag logkey:latest imfsiddiqui/logkey:<version>
Replace <version>
with the appropriate version number e.g. 1.0.1
or latest
.
๐ค Push the Docker Image to Docker Hub
Publish the updated Docker image to Docker Hub:
docker push imfsiddiqui/logkey:<version>
latest
tag can also be published:
docker push imfsiddiqui/logkey:latest
โ Verify the Published Image
Pull the image from Docker Hub to verify it was published correctly:
docker pull imfsiddiqui/logkey:<version>
or
docker pull imfsiddiqui/logkey:latest
Run the pulled image to ensure it works as expected:
๐ง Linux
docker run -it --rm -v $(pwd)/:/app/data/ imfsiddiqui/logkey \
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
๐ช Windows: PowerShell
docker run -it --rm -v ${PWD}/:/app/data/ imfsiddiqui/logkey `
python app.py --exit-key x --csv-file /app/data/user_inputs.csv
By these steps, this can be ensured that updates are reflected in the Docker image and published for others to use.
๐ GitHub Actions
Following GitHub Actions are being used to automate key workflows:
๐ค .github/workflows/pages.yml
Automatically builds and deploys the documentation website using Jekyll whenever changes are pushed to the default branch main
, a new tag starting with v
(e.g., v1.0.0
) is pushed, or the workflow is manually triggered.
๐ค .github/workflows/release.yml
Creates a new GitHub release when a tag starting with v
is pushed. This automates the release process and makes new versions easily accessible to users.
๐ค .github/workflows/package.yml
Builds a Docker image and publishes it to GitHub Container Registry (ghcr.io
) every time a new tag starting with v
(e.g., v1.0.0
) is pushed. This ensures the latest version of the application is always available as a container image.