forked from venetoarpa/arpav-cline-backend
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from ricardogsilva/24-use-poetry
Use poetry as package manager
- Loading branch information
Showing
12 changed files
with
2,305 additions
and
413 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 +1,4 @@ | ||
.env | ||
.venv | ||
|
||
tileserver |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,59 @@ | ||
FROM python:3.10 | ||
|
||
# Install dependencies | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
curl \ | ||
gdal-bin \ | ||
apt-utils \ | ||
libgdal-dev \ | ||
tini | ||
|
||
# download poetry | ||
RUN curl --silent --show-error --location \ | ||
https://install.python-poetry.org > /opt/install-poetry.py | ||
|
||
# Create a normal non-root user so that we can use it to run | ||
RUN useradd --create-home appuser | ||
|
||
# Compile python stuff to bytecode to improve startup times | ||
RUN python -c "import compileall; compileall.compile_path(maxlevels=10)" | ||
|
||
USER appuser | ||
|
||
# create relevant directories and install poetry | ||
RUN mkdir /home/appuser/app && \ | ||
mkdir /home/appuser/data && \ | ||
python opt/install-poetry.py --yes --version 1.7.1 | ||
|
||
ENV PATH="$PATH:/home/appuser/.local/bin" \ | ||
PYTHONUNBUFFERED=1 \ | ||
# This allows us to get traces whenever some C code segfaults | ||
PYTHONFAULTHANDLER=1 | ||
|
||
WORKDIR /home/appuser/app | ||
|
||
COPY --chown=appuser:appuser pyproject.toml poetry.lock ./ | ||
|
||
RUN poetry install --no-root --only main | ||
|
||
EXPOSE 8000 | ||
|
||
ARG GIT_COMMIT | ||
ENV GIT_COMMIT=$GIT_COMMIT \ | ||
DJANGO_SETTINGS_MODULE=djangoapp.settings | ||
|
||
# Now install our code | ||
COPY --chown=appuser:appuser . . | ||
RUN poetry install --only main | ||
|
||
# Write git commit identifier into the image | ||
RUN echo $GIT_COMMIT > /home/appuser/git-commit.txt | ||
|
||
# Compile python stuff to bytecode to improve startup times | ||
RUN poetry run python -c "import compileall; compileall.compile_path(maxlevels=10)" | ||
|
||
# use tini as the init process | ||
ENTRYPOINT ["tini", "-g", "--", "poetry", "run", "django-admin"] | ||
|
||
CMD ["runserver", "0.0.0.0:8000"] |
Oops, something went wrong.