Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
FROM quay.io/podman/stable:latest
EXPOSE 5000

RUN dnf -y install dnf-plugins-core
RUN dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

RUN dnf -y update \
RUN dnf -y install dnf-plugins-core \
&& dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo \
&& dnf -y update \
&& dnf -y install python3.8 \
python3.9 \
python3.10 \
Expand All @@ -27,15 +26,22 @@ RUN dnf -y update \
&& rm -rf /var/cache /var/log/dnf* /var/log/yum.*

ENV USER_BIN_DIR="/root/.local/bin"
ENV UV_INSTALL_DIR="/root/.local"
ENV PATH="$PATH:$USER_BIN_DIR"

ENV DATA_DIR=/webhook_server
ENV APP_DIR=/github-webhook-server
ENV PATH="$USER_BIN_DIR:$PATH"

RUN mkdir -p $USER_BIN_DIR \
&& mkdir -p $DATA_DIR \
&& mkdir -p $DATA_DIR/logs \
&& mkdir -p /tmp/containers

# Download the latest uv installer
RUN curl -sSL https://astral.sh/uv/install.sh -o /tmp/uv-installer.sh \
&& sh /tmp/uv-installer.sh \
&& rm /tmp/uv-installer.sh

RUN set -x \
&& curl https://mirror.openshift.com/pub/openshift-v4/clients/rosa/latest/rosa-linux.tar.gz --output /tmp/rosa-linux.tar.gz \
&& tar xvf /tmp/rosa-linux.tar.gz --no-same-owner \
Expand All @@ -59,15 +65,10 @@ RUN python3.8 -m ensurepip \
&& python3.11 -m pip install tox \
&& python3.12 -m pip install tox

COPY entrypoint.sh pyproject.toml poetry.lock README.md $APP_DIR/
COPY entrypoint.sh pyproject.toml uv.lock README.md $APP_DIR/
COPY webhook_server_container $APP_DIR/webhook_server_container/

WORKDIR $APP_DIR

RUN poetry config cache-dir $APP_DIR \
&& poetry config virtualenvs.in-project true \
&& poetry config installer.max-workers 10 \
&& poetry install

HEALTHCHECK CMD curl --fail http://127.0.0.1:5000/webhook_server/healthcheck || exit 1
ENTRYPOINT ["./entrypoint.sh"]
6 changes: 3 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

rm -rf /run/containers/storage /run/libpod

SERVER_RUN_CMD="poetry run uvicorn webhook_server_container.app:FASTAPI_APP --host 0.0.0.0 --port 5000 "
SERVER_RUN_CMD="uv run uvicorn webhook_server_container.app:FASTAPI_APP --host 0.0.0.0 --port 5000 "
Comment thread
myakove marked this conversation as resolved.
UVICORN_WORKERS="${UVICORN_MAX_WORKERS:=10}"

set -ep

poetry run python webhook_server_container/utils/github_repository_settings.py
poetry run python webhook_server_container/utils/webhook.py
uv run webhook_server_container/utils/github_repository_settings.py
uv run webhook_server_container/utils/webhook.py

if [[ -z $DEVELOPMENT ]]; then
eval "${SERVER_RUN_CMD} --workers ${UVICORN_WORKERS}"
Expand Down
79 changes: 34 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,54 @@ no_implicit_optional = true
show_error_codes = true
warn_unused_ignores = true

[tool.poetry]
[project]
name = "github-webhook-server"
version = "0.0.0"
version = "1.0.68"
requires-python = ">=3.8"
description = "A webhook server to manage Github reposotories and pull requests."
authors = [
"Meni Yakove <myakove@gmail.com>",
"Ruth Netser <ruth.netser@gmail.com>",
{ "name" = "Meni Yakove", "email" = " myakove@gmail.com" },
{ "name" = "Ruth Netser", "email" = "ruth.netser@gmail.com" },
Comment thread
myakove marked this conversation as resolved.
]
readme = "README.md"
license = "Apache-2.0"
homepage = "https://github.com/myakove/github-webhook-server"
repository = "https://github.com/myakove/github-webhook-server"
packages = [{ include = "webhook_server_container" }]
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"build>=1.2.2.post1",
"colorama>=0.4.6",
"colorlog>=6.8.2",
"fastapi>=0.115.0",
"jira>=3.8.0",
"pygithub>=2.4.0",
"pyhelper-utils>=0.0.42",
"pytest-mock>=3.14.0",
"pytest>=8.3.3",
"python-simple-logger>=1.0.40",
"pyyaml>=6.0.2",
"requests>=2.32.3",
"ruff>=0.6.9",
"shortuuid>=1.0.13",
"string-color>=1.2.3",
"timeout-sampler>=0.0.46",
"uvicorn>=0.31.0",
"uwsgi>=2.0.27",
]
Comment thread
myakove marked this conversation as resolved.

[tool.hatch.build.targets.wheel]
packages = ["webhook_server_container"]

[tool.poetry.urls]
[project.urls]
homepage = "https://github.com/myakove/github-webhook-server"
repository = "https://github.com/myakove/github-webhook-server"
Download = "https://quay.io/repository/myakove/github-webhook-server"
"Bug Tracker" = "https://github.com/myakove/github-webhook-server/issues"

[tool.poetry.dependencies]
python = "^3.8"
poetry-dynamic-versioning = { extras = ["plugin"], version = "^1.0.0" }
pygithub = "^2.0.0"
pyyaml = "^6.0"
build = "^1.0.0"
shortuuid = "^1.0.11"
colorlog = "^6.7.0"
colorama = "^0.4.6"
ruff = "^0.6.0"
timeout-sampler = "^0.0.46"
requests = "^2.31.0"
jira = "^3.8.0"
pyhelper-utils = "^0.0.42"
uwsgi = "^2.0.26"
fastapi = "^0.115.0"
python-simple-logger = "^1.0.30"
uvicorn = "^0.31.0"
string-color = "^1.2.3"

[tool.poetry.group.dev.dependencies]
ipdb = "^0.13.13"
ipython = "*"


[tool.poetry.group.tests.dependencies]
pytest-mock = "^3.14.0"
pytest = "^8.3.3"

[tool.poetry-dynamic-versioning]
enable = true
pattern = "((?P<epoch>\\d+)!)?(?P<base>\\d+(\\.\\d+)*)"

[tool.poetry-dynamic-versioning.substitution]
files = ["VERSION"]
[tool.uv]
dev-dependencies = ["ipdb>=0.13.13", "ipython>=8.12.3"]

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
requires = ["hatchling"]
build-backend = "hatchling.build"
Comment thread
myakove marked this conversation as resolved.
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ commands =

[testenv:pytest]
deps =
poetry
uv
commands =
poetry install
poetry run pytest webhook_server_container/tests
uv run pytest webhook_server_container/tests
Loading