working on dockerization
This commit is contained in:
parent
0be2fcbbe5
commit
2ed51cbf44
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@ -0,0 +1,48 @@
|
||||
FROM python:3.11.5-slim-bookworm
|
||||
|
||||
ARG YOUR_ENV
|
||||
ARG APP_SETTINGS
|
||||
ARG APP_DIRECTORY
|
||||
ARG APP_CHECK_INTERVAL
|
||||
ARG APP_PORT
|
||||
|
||||
ENV YOUR_ENV=${YOUR_ENV} \
|
||||
PYTHONFAULTHANDLER=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONHASHSEED=random \
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
# Poetry's configuration:
|
||||
POETRY_NO_INTERACTION=1 \
|
||||
POETRY_VIRTUALENVS_CREATE=false \
|
||||
POETRY_CACHE_DIR='/var/cache/pypoetry' \
|
||||
POETRY_HOME='/usr' \
|
||||
POETRY_VERSION=1.8.3 \
|
||||
# ^^^
|
||||
# Make sure to update it!
|
||||
SETTINGS=${APP_SETTINGS} \
|
||||
DIRECTORY=${APP_DIRECTORY} \
|
||||
CHECK_INTERVAL=${APP_CHECK_INTERVAL} \
|
||||
PORT=${APP_PORT}
|
||||
|
||||
# System deps:
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
RUN ls -la /usr/bin
|
||||
|
||||
RUN alias poetry=/usr/bin/poetry
|
||||
|
||||
RUN poetry lock
|
||||
|
||||
# Copy only requirements to cache them in docker layer
|
||||
WORKDIR /app
|
||||
COPY poetry.lock pyproject.toml /app/
|
||||
|
||||
# Project initialization:
|
||||
RUN poetry install $(test "$YOUR_ENV" == production && echo "--only=main") --no-interaction --no-ansi
|
||||
|
||||
# Creating folders, and files for a project:
|
||||
COPY src /app
|
||||
|
||||
CMD ["poetry", "run", "rss-feedler"]
|
@ -4,6 +4,9 @@ version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["bvn13 <from.github@bvn13.me>"]
|
||||
readme = "README.md"
|
||||
packages = [
|
||||
{ include = "src" }
|
||||
]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.12"
|
||||
@ -13,6 +16,8 @@ tornado = "^6.4.1"
|
||||
asyncio = "^3.4.3"
|
||||
scheduler = "^0.8.7"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
rss-feedler = "src.app:start"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
@ -6,8 +6,8 @@ import time
|
||||
import threading
|
||||
from scheduler import Scheduler
|
||||
|
||||
from fetcher import fetch
|
||||
from server import start_server
|
||||
from src.fetcher import fetch
|
||||
from src.server import start_server
|
||||
from src.logger import logger as l
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ from requests import Session
|
||||
from requests.adapters import HTTPAdapter
|
||||
from urllib3.util import Retry
|
||||
from src.logger import logger as l
|
||||
import stats
|
||||
import src.stats as stats
|
||||
|
||||
|
||||
def fetch(settings: list, args: Namespace) -> None:
|
||||
|
@ -3,7 +3,7 @@ import os
|
||||
from argparse import Namespace
|
||||
import tornado
|
||||
from src.logger import logger as l
|
||||
import stats
|
||||
import src.stats as stats
|
||||
|
||||
|
||||
def start_server(settings: list, args: Namespace) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user