diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 862da8d..976fd9d 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -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: diff --git a/Containerfile.deps b/Containerfile.deps index ec562a6..758480f 100644 --- a/Containerfile.deps +++ b/Containerfile.deps @@ -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 diff --git a/Containerfile.for_runner b/Containerfile.for_runner new file mode 100644 index 0000000..d95d16b --- /dev/null +++ b/Containerfile.for_runner @@ -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"]