aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-09-18 01:13:15 +0400
committerGravatar Hassan Abouelela <[email protected]>2022-09-18 01:13:15 +0400
commit13522f2dfc21b06d18e23759dab211c7c0e0c8b8 (patch)
treea042230f735517fea757476efe335d3ce2798df0
parentMerge pull request #20 from python-discord/update-staff-channel-logic (diff)
Fix Poetry 1.2 Support
Poetry 1.2 introduced a regression which broke pip `--user` installs. These types of install were the main way we did installations in docker and CI, as they made it much more convenient to control the location, availability, and caching of packages. Poetry's team does not recognize this as a supported use case, so major changes were required to get everything working again. Most of the changes were consolidated into chrislovering/python-poetry-base for docker, and HassanAbouelela/setup-python for CI.
-rw-r--r--.github/workflows/lint.yml2
-rw-r--r--Dockerfile17
-rw-r--r--entry_point.sh4
3 files changed, 8 insertions, 15 deletions
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 65c855e..a387dbe 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v2
- name: Install Python Dependencies
- uses: HassanAbouelela/actions/setup-python@setup-python_v1.1.0
+ uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1
with:
# Set dev=true to install flake8 extensions, which are dev dependencies
dev: true
diff --git a/Dockerfile b/Dockerfile
index 926b015..fe2d01f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,19 +1,12 @@
-FROM python:3.9.5-slim
+FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.9-slim
-ENV PYTHONFAULTHANDLER=1 \
- PYTHONUNBUFFERED=1 \
- PYTHONHASHSEED=random \
- PIP_NO_CACHE_DIR=off \
- PIP_DISABLE_PIP_VERSION_CHECK=on \
- PIP_DEFAULT_TIMEOUT=100
-
-RUN pip install poetry
+ENV PYTHONHASHSEED=random
+# Install Dependencies
WORKDIR /metricity
-COPY poetry.lock pyproject.toml /metricity/
+COPY poetry.lock pyproject.toml ./
+RUN poetry install
-RUN poetry config virtualenvs.create false && poetry install
COPY . /metricity
-
CMD ["bash", "entry_point.sh"]
diff --git a/entry_point.sh b/entry_point.sh
index 56072d0..3894eff 100644
--- a/entry_point.sh
+++ b/entry_point.sh
@@ -1,7 +1,7 @@
set -e
-python create_metricity_db.py
-alembic upgrade head
+poetry run python create_metricity_db.py
+poetry run alembic upgrade head
if [ -e /tmp/bot/metricity-config.toml ]; then
echo "Detected metricity running in bot context, copying config."