Initial commit
Some checks failed
/ build (push) Failing after 23s

This commit is contained in:
phil 2024-10-27 02:09:13 +02:00
parent 1da1965b3c
commit 5b5258428b
7 changed files with 72 additions and 27 deletions

View file

@ -5,7 +5,7 @@ jobs:
build:
runs-on: container
container:
image: tiptop:5000/treetrail-backend-ci-base
image: tiptop:5000/treetrail-backend-ci
volumes:
- "/root/.cache/uv:uv_cache"
services:
@ -24,7 +24,7 @@ jobs:
- name: Build container
uses: actions/buildah-build@v1
with:
image: treetrail-srv
image: treetrail-backend
#tags: foo # v1 ${{ github.sha }}
containerfiles: |
./Containerfile.for_runner
@ -32,5 +32,5 @@ jobs:
- uses: actions/push-to-registry@v2
with:
registry: "docker://${{ vars.REPOSITORY }}"
image: treetrail-srv
image: treetrail-backend
tags: latest

View file

@ -1,12 +1,29 @@
FROM localhost/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 .
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
ENV PATH=/app/bin:$PATH
RUN <<EOT
groupadd -r app
useradd -r -d /app -g app -N app
mkdir /var/lib/treetrail
chown app: /var/lib/treetrail
EOT
COPY --from=localhost/treetrail-backend-base --chown=app:app /app /app
USER app
WORKDIR /app
# Instances should override the prod.yaml file
COPY ./prod.yaml /etc/treetrail/prod.yaml
#COPY ./prod.yaml /etc/treetrail/prod.yaml
#COPY ./dist/treetrail_backend-0.3.0.tar.gz /src/
CMD ["uvicorn", "treetrail.application:app", "--port", "8081", "--log-config", "logging.yaml", "--host", "0.0.0.0"]
#RUN uv pip install /src/treetrail_backend-0.3.0.tar.gz
CMD [ \
"uvicorn", "treetrail.application:app", \
"--port", "8081", \
#"--log-config", "/app/config/logging.yaml", \
"--host", "0.0.0.0" \
]

17
Containerfile.base Normal file
View file

@ -0,0 +1,17 @@
FROM localhost/treetrail-backend-deps as base
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
COPY ./src/ /src/src
COPY ./tests/ /src/tests
COPY ./pyproject.toml /src/
COPY ./README.md /src/
COPY ./uv.lock /src/
RUN --mount=type=cache,target=/root/.cache \
cd /src && uv sync --locked --no-dev --no-editable
#uv pip install \
# --python=$UV_PROJECT_ENVIRONMENT \
# --no-deps \
# /src

View file

@ -1,8 +1,10 @@
FROM localhost/trixie_python
MAINTAINER philo email phil.dev@philome.mooo.com
FROM localhost/trixie_python AS build
#ENV PYTHONDONTWRITEBYTECODE 1
ENV PATH=/app/bin:$PATH
WORKDIR /usr/src/treetrail
COPY ./pyproject.toml ./README.md ./uv.lock .
RUN uv sync
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
RUN --mount=type=cache,target=/root/.cache <<EOT
cd /_lock
uv sync --locked --no-dev --no-install-project
EOT

View file

@ -1,11 +1,19 @@
FROM debian:trixie-slim
MAINTAINER philo email phil.dev@philome.mooo.com
RUN apt update
RUN apt install --no-install-recommends -y python-is-python3 python3-pip python3-venv
RUN pip install --break-system-packages pdm
RUN <<EOT
apt-get update -qy
apt-get install -qyy \
-o APT::Install-Recommends=false \
-o APT::Install-Suggests=false \
ca-certificates \
python-is-python3
apt-get clean
EOT
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
RUN rm -rf /root/.cache
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=never \
#UV_PYTHON=python3.12 \
UV_PROJECT_ENVIRONMENT=/app

View file

@ -1,5 +1,5 @@
[project]
name = "treetrail-srv"
name = "treetrail-backend"
version = "0.3.0"
#dynamic = ["version"]
#dynamic = ["version"]
@ -47,7 +47,7 @@ classifiers = [
]
#[project.scripts]
#treetrail-srv = "treetrail_srv:main"
#treetrail-backend = "treetrail_backend:main"
[build-system]
requires = ["hatchling"]
@ -57,6 +57,7 @@ build-backend = "hatchling.build"
packages = ["src/treetrail"]
[tool.uv]
package = true
dev-dependencies = [
"httpx",
"ipdb",

2
uv.lock generated
View file

@ -1588,7 +1588,7 @@ wheels = [
]
[[package]]
name = "treetrail-srv"
name = "treetrail-backend"
version = "0.3.0"
source = { editable = "." }
dependencies = [