Skip to content

Commit d6aa129

Browse files
Merge pull request #213 from python-discord/poetry-1.2
Fix Poetry 1.2 Support
2 parents bb0c4bb + 9eefe45 commit d6aa129

File tree

2 files changed

+11
-36
lines changed

2 files changed

+11
-36
lines changed

.github/workflows/forms-backend.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,16 @@ jobs:
1515
- name: Checkout repository
1616
uses: actions/checkout@v2
1717

18-
- name: Setup Python
19-
id: python
20-
uses: actions/setup-python@v2
18+
- name: Install Python Dependencies
19+
uses: HassanAbouelela/actions/setup-python@setup-python_v1.3.1
2120
with:
22-
python-version: '3.9'
23-
24-
- name: Setup Poetry
25-
uses: snok/[email protected]
26-
with:
27-
virtualenvs-create: true
28-
virtualenvs-in-project: true
29-
30-
# When same context exists in cache already, restore this environment.
31-
- name: Poetry Environment Caching
32-
uses: actions/cache@v2
33-
id: python_cache
34-
with:
35-
path: .venv
36-
key: "venv-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}"
37-
38-
# Only install dependencies when cache didn't hit.
39-
- name: Install dependencies
40-
if: steps.python_cache.outputs.cache-hit != 'true'
41-
run: |
42-
poetry install
21+
dev: true
22+
python_version: "3.9"
4323

4424
# Use this formatting to show them as GH Actions annotations.
4525
- name: Run flake8
46-
run: "poetry run flake8 --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'"
26+
run: |
27+
flake8 --format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'
4728
4829
# Prepare the Pull Request Payload artifact. If this fails, we
4930
# we fail silently using the `continue-on-error` option. It's

Dockerfile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=linux/amd64 python:3.9-slim
1+
FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.9-slim
22

33
# Allow service to handle stops gracefully
44
STOPSIGNAL SIGQUIT
@@ -8,19 +8,12 @@ RUN apt-get update && \
88
apt-get install -y gcc make && \
99
apt-get clean && rm -rf /var/lib/apt/lists/*
1010

11-
# Install Poetry
12-
RUN pip install poetry
13-
14-
# Copy dependencies-related files
15-
COPY poetry.lock .
16-
COPY pyproject.toml .
17-
1811
# Install dependencies
19-
RUN poetry config virtualenvs.create false
20-
RUN poetry install --no-dev
12+
WORKDIR /app
13+
COPY pyproject.toml poetry.lock ./
14+
RUN poetry install --without dev
2115

2216
# Copy all files to container
23-
WORKDIR /app
2417
COPY . .
2518

2619
# Set Git SHA build argument
@@ -30,4 +23,5 @@ ARG git_sha="development"
3023
ENV GIT_SHA=$git_sha
3124

3225
# Start the server with uvicorn
26+
ENTRYPOINT ["poetry", "run"]
3327
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "backend:app"]

0 commit comments

Comments
 (0)