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
49 changes: 21 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
FROM python:3.10-slim

ARG token

# necessary env vars for poetry to work properly
ENV token=$token \
PYTHONUNBUFFERED=1 \
PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.3.2

# Install Poetry 1.3.2 via pip
RUN pip install -U pip \
&& apt-get update \
&& apt-get install gcc -y \
&& apt install -y libpq-dev python3-dev \
&& pip install "poetry==1.3.2" \
&& pip install setuptools>=65.5.1
ENV PATH="${PATH}:/root/.poetry/bin"
# Build-time dependencies for C extensions (e.g. psycopg2, Levenshtein)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

# Install modern Pip and Poetry into an isolated CLI location
RUN pip install --no-cache-dir -U pip setuptools \
&& pip install --no-cache-dir "poetry>=1.8.0"

WORKDIR /progphil-bot

# Leverage Docker layer caching: copy lockfiles first
COPY pyproject.toml poetry.lock ./

# Install project dependencies into Poetry's virtual environment
RUN poetry install --no-root --without dev

# Copy project source code after dependencies are installed
COPY README.md ./
COPY src ./src
COPY migrations ./migrations
COPY config ./config
COPY README.md ./

# Install Poetry dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev

COPY . .
# Install the root project package itself
RUN poetry install --without dev

# Run the bot
CMD ["poetry", "run", "progphil"]
# Run application using Poetry's virtual environment executable directly
CMD ["poetry", "run", "progphil"]
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ packages = [

[tool.poetry.dependencies]
python = "^3.10.14"
charset-normalizer = "^3.3.2" # <-- ADD THIS
python-dotenv = "^1.0.1"
pyyaml = "^6.0"
flake8 = "^7.1.0"
asyncpg = "^0.29.0"
requests = "^2.28.2"
requests = "^2.32.0" # <-- BUMP THIS (was 2.28.2)
yoyo-migrations = "^8.2.0"
cloudscraper = "^1.2.69"
bs4 = "^0.0.2"
Expand All @@ -29,9 +29,12 @@ pydantic = "^2.8.0"
python-dateutil = "^2.9.0"
discord-py = "^2.5.2"

[tool.poetry.group.dev.dependencies] # <-- MOVE DEV TOOLS HERE
flake8 = "^7.1.0"

[tool.poetry.scripts]
progphil = "main:run"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
build-backend = "poetry.core.masonry.api"
Loading