Remove PyPi build, convert project to not be a python module, add Docker build and files, update README,

This commit is contained in:
csd4ni3l
2025-10-23 11:01:21 +02:00
parent a9b5a53bdb
commit 391d55edba
16 changed files with 77 additions and 60 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
.env
.env.example
data.db
Dockerfile
docker-compose.yml

26
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: ci
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest

View File

@@ -1,31 +0,0 @@
name: Publish to PyPI
on: push
jobs:
build-and-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade build twine
- name: Build the package
run: |
python -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*

16
Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM debian:12-slim AS build
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip setuptools wheel
FROM build AS build-venv
COPY requirements.txt /requirements.txt
RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt
FROM gcr.io/distroless/python3-debian12
COPY --from=build-venv /venv /venv
COPY . /app
WORKDIR /app
ENTRYPOINT ["/venv/bin/python3", "app.py"]

View File

@@ -1,4 +1,4 @@
LoginWeen is a an app where you login/register with a halloween pumpkin carving as a password.
LoginWeen is an app where you login/register with a halloween pumpkin carving as a password.
Live Demo (coming soon!): https://loginween.csd4ni3l.hu
@@ -7,13 +7,17 @@ Live Demo (coming soon!): https://loginween.csd4ni3l.hu
## Download source & use uv
- Download source and change to it's directory
- copy `.env.example` to `.env` and update the settings as you like.
- `uv run loginween`
- `uv run app.py`
## Download source & use pip
- Download source and change to it's directory
- copy `.env.example` to `.env` and update the settings as you like.
- Copy `.env.example` to `.env` and update the settings as you like.
- **Optionally**, make and activate a virtual environment: `python3 -m venv .venv` and `source .venv/bin/activate`
- `pip3 install -r requirements.txt`
- `python3 loginween/app.py`
- `python3 app.py`
## Docker
- Coming soon!
## Docker CLI
- Run `docker run --name loginween -p 8080:8080 -e HOST=0.0.0.0 -e PORT=8080 -e DB_FILE=data.db -e APP_KEY=changeme -e DEBUG_MODE=true -v ./data.db:/app/data.db --restart unless-stopped csd4ni3lofficial/loginween:latest` and change the parameters
## Docker Compose
- Download the `docker-compose.yml` file from this repo and run `docker compose up -d` next to it.

View File

@@ -2,14 +2,14 @@ from flask import Flask, Response, render_template, redirect, url_for, g, reques
from flask_login import LoginManager, login_required
from loginween.pattern import Pattern
from pattern import Pattern
import sqlite3, os, flask_login, dotenv, secrets, json
import sqlite3, os, flask_login, dotenv, secrets
if os.path.exists(".env"):
dotenv.load_dotenv(".env")
else:
print(".env file not found. Continuing with default values.")
print(".env file not found. Continuing with Docker environment or default values.")
login_manager = LoginManager()
app = Flask(__name__)

16
docker-compose.yml Normal file
View File

@@ -0,0 +1,16 @@
services:
loginween:
image: csd4ni3lofficial/loginween:latest
build: .
container_name: loginween
ports:
- "8080:8080"
environment:
HOST: "0.0.0.0"
PORT: 8080
DB_FILE: "data.db"
APP_KEY: "changeme"
DEBUG_MODE: false
volumes:
- ./data.db:/app/data.db
restart: unless-stopped

View File

@@ -1 +0,0 @@
__version__ = "0.0.1"

View File

@@ -1,5 +0,0 @@
def main():
import loginween.main
if __name__ == "__main__":
main()

View File

@@ -14,17 +14,4 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
]
[project.scripts]
loginween = "loginween.run:main"
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true
[tool.setuptools.packages.find]
where = ["."]
]

View File

Before

Width:  |  Height:  |  Size: 946 B

After

Width:  |  Height:  |  Size: 946 B