From 1e7f01c6d512ef2577de9181dc53d3466d013042 Mon Sep 17 00:00:00 2001 From: Untone Date: Sat, 17 Feb 2024 03:35:59 +0300 Subject: [PATCH] poetry-2 --- Dockerfile | 22 +++++++++------------- pyproject.toml | 24 ++++++++++++++++++++++++ requirements.txt | 8 -------- 3 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index aa623ae..cfec316 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Use an official Ubuntu base image -FROM ubuntu:latest +# Use an official Python runtime as a parent image +FROM python:3.9-slim # Set the working directory in the container to /app WORKDIR /app @@ -10,21 +10,17 @@ EXPOSE 8000 # Update package lists and install build tools RUN apt-get update && apt-get install -y build-essential curl -# Install Rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ - /root/.cargo/env && \ - rustup toolchain install stable && \ - rustup default stable && \ - rustup update +# Install Poetry +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - -# Set environment variables for Rust -ENV PATH="/root/.cargo/bin:${PATH}" +# Copy only the pyproject.toml and poetry.lock files to the container +COPY pyproject.toml poetry.lock /app/ + +# Install project dependencies +RUN $HOME/.poetry/bin/poetry install --no-root # Copy the current directory contents into the container at /app COPY . /app -# Install Python dependencies -RUN pip install -r requirements.txt --no-cache - # Run server.py when the container launches CMD ["python", "server.py"] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9ccfc30 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,24 @@ +[tool.poetry] +name = "discoursio-notifier" +version = "0.3.0" +description = "notifier service for discours.io" +authors = ["Untone "] +license = "MIT" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.12" +aiohttp = "^3.9.3" +strawberry-graphql = {extras = ["asgi", "debug-server"], version = "^0.219.2"} +granian = "^1.1.0" +sentry-sdk = {extras = ["strawberry"], version = "^1.40.4"} +strawberry-sqlalchemy-mapper = "^0.4.2" +psycopg2-binary = "^2.9.9" +SQLAlchemy = "^2.0.27" + +[tool.poetry.group.dev.dependencies] +ruff = "^0.2.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 836ab72..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -aiohttp -strawberry-sqlalchemy-mapper -redis[hiredis] -psycopg2-binary -sqlalchemy -strawberry-graphql[asgi,debug-server] -granian -sentry-sdk[strawberry]