Merge branch 'master'

This commit is contained in:
phil 2024-10-26 18:04:49 +02:00
commit 1da1965b3c
3 changed files with 18 additions and 32 deletions

View file

@ -1,5 +1,6 @@
on:
push:
jobs:
build:
runs-on: container
@ -26,7 +27,7 @@ jobs:
image: treetrail-srv
#tags: foo # v1 ${{ github.sha }}
containerfiles: |
./Containerfile
./Containerfile.for_runner
- uses: actions/push-to-registry@v2
with:

View file

@ -1,36 +1,8 @@
FROM localhost/trixie_python
MAINTAINER philo email phil.dev@philome.mooo.com
#ENV PROJ_DIR=/usr
ENV PYTHONDONTWRITEBYTECODE 1
ENV PDM_CHECK_UPDATE=false
#RUN apk add --no-cache make cmake clang gdal-dev geos-dev proj-dev proj-util gcc musl-dev bash
#RUN apk add --no-cache gdal-dev geos-dev proj-dev proj-util gcc musl-dev bash
#ENV PYTHONDONTWRITEBYTECODE 1
WORKDIR /usr/src/treetrail
COPY ./pyproject.toml ./README.md ./pdm.lock .
# Cheating pdm with the app version to allow install of dependencies
RUN PDM_BUILD_SCM_VERSION=1.0 pdm install --check --prod --no-editable
## Instances should populate these dirs below
RUN mkdir -p /usr/local/treetrail/osm \
/usr/local/treetrail/sprite \
/usr/local/treetrail/cache/plantekey/img \
/usr/local/treetrail/cache/plantekey/thumbnails \
/usr/local/treetrail/cache/plantekey/type \
/usr/local/treetrail/map/sprite \
/usr/local/treetrail/map/osm \
/usr/local/treetrail/attachments/tree \
/usr/local/treetrail/attachments/trail \
/usr/local/treetrail/attachments/poi
#COPY ./sprite /usr/local/treetrail
#COPY ./osm /usr/local/treetrail
#RUN python -c 'import _version as v;print(v.__version__)' > version.txt
#RUN PDM_BUILD_SCM_VERSION=$(cat version.txt) pdm install --check --prod --no-editable
#
# Clear some space (caches)
#RUN pdm cache clear
#RUN rm -rf .mypy_cache
#RUN rm -rf __pycache__
COPY ./pyproject.toml ./README.md ./uv.lock .
RUN uv sync

13
Containerfile.for_runner Normal file
View file

@ -0,0 +1,13 @@
# FIXME: do not use hardcoded registry
FROM tiptop:5000/trixie_python
WORKDIR /usr/src/treetrail
ENV PATH="/usr/src/treetrail/.venv/bin:$PATH"
ENV PYTHONPATH="/usr/src"
COPY --from=localhost/treetrail_backend_deps /usr/src/treetrail/.venv/ /usr/src/treetrail/.venv
COPY --from=localhost/treetrail_backend_deps /usr/local/treetrail/ /usr/local/treetrail
COPY ./treetrail ./pyproject.toml ./README.md .
# Instances should override the prod.yaml file
COPY ./prod.yaml /etc/treetrail/prod.yaml
CMD ["uvicorn", "treetrail.application:app", "--port", "8081", "--log-config", "logging.yaml", "--host", "0.0.0.0"]