Skip to content

Commit

Permalink
fix(docker): Move install to last step
Browse files Browse the repository at this point in the history
------------
The Problems
------------
There are namely two problems which are being fixed in this issue:

1. `pyproject.toml` defines `modmail` package to be included, thus
poetry searches for it but finds it be to be empty as originally
we copied the poetry meta files only before installing and then
copied rest of the package.

2. We are using pip to install poetry, we uses the new installer,
the new installer has a known bug see python-poetry/poetry#3336 but
the issue hasn't shown any acitivty since it has been opened
unfortunately.

------------
The Solution
-----------

1. I have moved `COPY . .` to be ran before poetry install so
poetry can find what the package to be included.

2. The only possible solution to this is to disable the old
installer which was causing this bug for some reason.
  • Loading branch information
Shivansh-007 committed Aug 12, 2021
1 parent 97bd595 commit 2f96f4f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ RUN apt-get update && apt-get install -y \
# Install poetry
RUN pip install -U poetry

# See https://github.com/python-poetry/poetry/issues/3336
RUN poetry config experimental.new-installer false

# Create the working directory
WORKDIR /modmail

# Install project dependencies
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev

# Copy the source code in last to optimize rebuilding the image
COPY . .

# Install project dependencies
RUN poetry install --no-dev

CMD ["python", "-m", "modmail"]

0 comments on commit 2f96f4f

Please sign in to comment.