parent
1da1965b3c
commit
5b5258428b
7 changed files with 72 additions and 27 deletions
|
@ -5,7 +5,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: container
|
runs-on: container
|
||||||
container:
|
container:
|
||||||
image: tiptop:5000/treetrail-backend-ci-base
|
image: tiptop:5000/treetrail-backend-ci
|
||||||
volumes:
|
volumes:
|
||||||
- "/root/.cache/uv:uv_cache"
|
- "/root/.cache/uv:uv_cache"
|
||||||
services:
|
services:
|
||||||
|
@ -24,7 +24,7 @@ jobs:
|
||||||
- name: Build container
|
- name: Build container
|
||||||
uses: actions/buildah-build@v1
|
uses: actions/buildah-build@v1
|
||||||
with:
|
with:
|
||||||
image: treetrail-srv
|
image: treetrail-backend
|
||||||
#tags: foo # v1 ${{ github.sha }}
|
#tags: foo # v1 ${{ github.sha }}
|
||||||
containerfiles: |
|
containerfiles: |
|
||||||
./Containerfile.for_runner
|
./Containerfile.for_runner
|
||||||
|
@ -32,5 +32,5 @@ jobs:
|
||||||
- uses: actions/push-to-registry@v2
|
- uses: actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
registry: "docker://${{ vars.REPOSITORY }}"
|
registry: "docker://${{ vars.REPOSITORY }}"
|
||||||
image: treetrail-srv
|
image: treetrail-backend
|
||||||
tags: latest
|
tags: latest
|
||||||
|
|
|
@ -1,12 +1,29 @@
|
||||||
FROM localhost/trixie_python
|
FROM localhost/trixie_python
|
||||||
WORKDIR /usr/src/treetrail
|
|
||||||
ENV PATH="/usr/src/treetrail/.venv/bin:$PATH"
|
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
ENV PYTHONPATH="/usr/src"
|
ENV PATH=/app/bin:$PATH
|
||||||
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
|
RUN <<EOT
|
||||||
COPY ./treetrail ./pyproject.toml ./README.md .
|
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
|
# 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
17
Containerfile.base
Normal 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
|
|
@ -1,8 +1,10 @@
|
||||||
FROM localhost/trixie_python
|
FROM localhost/trixie_python AS build
|
||||||
MAINTAINER philo email phil.dev@philome.mooo.com
|
|
||||||
|
|
||||||
#ENV PYTHONDONTWRITEBYTECODE 1
|
ENV PATH=/app/bin:$PATH
|
||||||
|
|
||||||
WORKDIR /usr/src/treetrail
|
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
|
||||||
COPY ./pyproject.toml ./README.md ./uv.lock .
|
|
||||||
RUN uv sync
|
RUN --mount=type=cache,target=/root/.cache <<EOT
|
||||||
|
cd /_lock
|
||||||
|
uv sync --locked --no-dev --no-install-project
|
||||||
|
EOT
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
FROM debian:trixie-slim
|
FROM debian:trixie-slim
|
||||||
MAINTAINER philo email phil.dev@philome.mooo.com
|
|
||||||
|
|
||||||
RUN apt update
|
RUN <<EOT
|
||||||
RUN apt install --no-install-recommends -y python-is-python3 python3-pip python3-venv
|
apt-get update -qy
|
||||||
RUN pip install --break-system-packages pdm
|
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 && \
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[project]
|
[project]
|
||||||
name = "treetrail-srv"
|
name = "treetrail-backend"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
#dynamic = ["version"]
|
#dynamic = ["version"]
|
||||||
#dynamic = ["version"]
|
#dynamic = ["version"]
|
||||||
|
@ -47,7 +47,7 @@ classifiers = [
|
||||||
]
|
]
|
||||||
|
|
||||||
#[project.scripts]
|
#[project.scripts]
|
||||||
#treetrail-srv = "treetrail_srv:main"
|
#treetrail-backend = "treetrail_backend:main"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["hatchling"]
|
||||||
|
@ -57,6 +57,7 @@ build-backend = "hatchling.build"
|
||||||
packages = ["src/treetrail"]
|
packages = ["src/treetrail"]
|
||||||
|
|
||||||
[tool.uv]
|
[tool.uv]
|
||||||
|
package = true
|
||||||
dev-dependencies = [
|
dev-dependencies = [
|
||||||
"httpx",
|
"httpx",
|
||||||
"ipdb",
|
"ipdb",
|
||||||
|
|
2
uv.lock
generated
2
uv.lock
generated
|
@ -1588,7 +1588,7 @@ wheels = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "treetrail-srv"
|
name = "treetrail-backend"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue