Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend: Migrate build system to poetry
Since Poetry has better support for dependency management than using a simple pip requirements file, Poetry is now used to fetch dependencies. Also the versions are now more stricly given, since sometimes the most up-to-date versions are not compatible with other up-to-date versions. This happens with the new flask version 2.0.0, which came out this week and break the build, since flask-restx is not working correctly with flask 2.0.0 See python-restx/flask-restx#308
- Loading branch information
Showing
4 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
FROM python:3.8-slim-buster | ||
WORKDIR /app | ||
|
||
COPY requirements.txt /app/requirements.txt | ||
RUN pip3 install -r requirements.txt | ||
ENV PYTHONFAULTHANDLER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONHASHSEED=random \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VERSION=1.1.6 \ | ||
GUNICORN_VERSION=20.1.0 | ||
|
||
RUN pip3 install gunicorn | ||
RUN pip install poetry==$POETRY_VERSION gunicorn==$GUNICORN_VERSION | ||
|
||
# copy requirements first for caching | ||
COPY poetry.lock pyproject.toml /app/ | ||
|
||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev --no-interaction --no-ansi | ||
|
||
COPY . /app/backend | ||
CMD ["gunicorn", "--bind=0.0.0.0:5000", "backend.wsgi:app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[tool.poetry] | ||
name = "openenergize-backend" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Jan Bucher <jan@bucher.cloud>"] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
Flask = "^1.1.4" | ||
flask-restx = "^0.4.0" | ||
requests = "^2.25.1" | ||
PyYAML = "^5.4.1" | ||
pymodbus = "^2.5.2" | ||
cachetools = "^4.2.2" | ||
|
||
[tool.poetry.dev-dependencies] | ||
pytest = "^6.2.4" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" |
This file was deleted.
Oops, something went wrong.