Compare commits
2 commits
d552656e95
...
21bd7a904f
Author | SHA1 | Date | |
---|---|---|---|
21bd7a904f | |||
51d131600e |
4 changed files with 59 additions and 7 deletions
|
@ -14,7 +14,7 @@ on:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
runs-on: container
|
runs-on: container
|
||||||
container:
|
container:
|
||||||
image: tiptop:5000/treetrail-backend-ci
|
image: tiptop:5000/treetrail-backend-ci
|
||||||
|
@ -35,9 +35,32 @@ jobs:
|
||||||
- name: Install app with 'uv pip install'
|
- name: Install app with 'uv pip install'
|
||||||
run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps .
|
run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps .
|
||||||
|
|
||||||
- name: Run basic test (API call)
|
- name: Run tests (API call)
|
||||||
run: pytest -s tests/basic.py
|
run: pytest -s tests/basic.py
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: container
|
||||||
|
if: ${{ inputs.build }}
|
||||||
|
container:
|
||||||
|
image: tiptop:5000/treetrail-backend-ci
|
||||||
|
volumes:
|
||||||
|
- "uv_cache:/root/.cache/uv"
|
||||||
|
- "ca-cert:/etc/containers/certs.d"
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install app with 'uv pip install'
|
||||||
|
run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps .
|
||||||
|
|
||||||
|
- name: Git unshallow - get all history from Git to get the tag for the computation of the version
|
||||||
|
if: ${{ inputs.build }}
|
||||||
|
run: git pull --unshallow
|
||||||
|
|
||||||
|
- name: Get the version from git
|
||||||
|
if: ${{ inputs.build }}
|
||||||
|
id: version
|
||||||
|
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Workaround for bug of podman-login
|
- name: Workaround for bug of podman-login
|
||||||
if: ${{ inputs.build }}
|
if: ${{ inputs.build }}
|
||||||
run: |
|
run: |
|
||||||
|
@ -57,10 +80,10 @@ jobs:
|
||||||
if: ${{ inputs.build }}
|
if: ${{ inputs.build }}
|
||||||
uses: actions/buildah-build@v1
|
uses: actions/buildah-build@v1
|
||||||
with:
|
with:
|
||||||
image: treetrail-backend
|
image: "treetrail-backend:${{ steps.version.outputs.version }}"
|
||||||
#tags: foo # v1 ${{ github.sha }}
|
#tags: foo # v1 ${{ github.sha }}
|
||||||
containerfiles: |
|
containerfiles: |
|
||||||
./Containerfile.for_runner
|
./Containerfile
|
||||||
|
|
||||||
- name: Push the image to the registry
|
- name: Push the image to the registry
|
||||||
uses: actions/push-to-registry@v2
|
uses: actions/push-to-registry@v2
|
||||||
|
@ -68,4 +91,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
registry: "docker://${{ vars.REGISTRY }}"
|
registry: "docker://${{ vars.REGISTRY }}"
|
||||||
image: treetrail-backend
|
image: treetrail-backend
|
||||||
tags: latest
|
tags: ${{ steps.version.outputs.version }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
||||||
|
|
||||||
FROM localhost/treetrail-backend-deps
|
FROM tiptop:5000/treetrail-backend-deps
|
||||||
|
|
||||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Build: podman build -t treetrail-backend-deps -f Containerfile.deps
|
# Build: podman build -t treetrail-backend-deps -f Containerfile.deps
|
||||||
|
|
||||||
FROM localhost/trixie_python
|
FROM tiptop:5000/trixie_python
|
||||||
|
|
||||||
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
|
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
|
||||||
|
|
||||||
|
|
29
Containerfile.full_copy
Normal file
29
Containerfile.full_copy
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
FROM localhost/trixie_python
|
||||||
|
|
||||||
|
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 ./dist/treetrail_backend-0.3.0.tar.gz /src/
|
||||||
|
|
||||||
|
#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" \
|
||||||
|
]
|
Loading…
Add table
Add a link
Reference in a new issue