This commit is contained in:
parent
9ca2ea638e
commit
114201d561
8 changed files with 80 additions and 26 deletions
|
@ -58,7 +58,7 @@ jobs:
|
||||||
mkdir $HOME/.docker
|
mkdir $HOME/.docker
|
||||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
||||||
|
|
||||||
- name: Log in to container registry
|
- name: Log in to container registry (with another workaround)
|
||||||
uses: actions/podman-login@v1
|
uses: actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.REGISTRY }}
|
registry: ${{ vars.REGISTRY }}
|
||||||
|
|
|
@ -27,10 +27,9 @@ jobs:
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Create venv
|
#- name: Install dependencies
|
||||||
run: uv venv
|
# run: uv sync
|
||||||
- name: Install dependencies
|
|
||||||
run: uv sync
|
|
||||||
- name: Run basic test (bootstrap)
|
- name: Run basic test (bootstrap)
|
||||||
run: pytest -s tests/basic.py
|
run: pytest -s tests/basic.py
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ jobs:
|
||||||
mkdir $HOME/.docker
|
mkdir $HOME/.docker
|
||||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
||||||
|
|
||||||
- name: Log in to container registry
|
- name: Log in to container registry (with another workaround)
|
||||||
uses: actions/podman-login@v1
|
uses: actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
registry: ${{ vars.REGISTRY }}
|
registry: ${{ vars.REGISTRY }}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
FROM localhost/trixie_python
|
FROM localhost/treetrail-backend-base
|
||||||
|
|
||||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
|
||||||
ENV PATH=/app/bin:$PATH
|
|
||||||
|
|
||||||
RUN <<EOT
|
RUN <<EOT
|
||||||
groupadd -r app
|
groupadd -r app
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
||||||
|
|
||||||
FROM localhost/treetrail-backend-deps
|
FROM localhost/treetrail-backend-deps
|
||||||
|
|
||||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
|
@ -5,8 +7,10 @@ ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
COPY . /src
|
COPY . /src
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache \
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
cd /src && uv sync --locked --no-dev --no-editable
|
cd /src && \
|
||||||
#uv pip install \
|
uv sync --locked --no-dev --no-editable
|
||||||
# --python=$UV_PROJECT_ENVIRONMENT \
|
|
||||||
# --no-deps \
|
#uv pip install \
|
||||||
# /src
|
# --python=$UV_PROJECT_ENVIRONMENT \
|
||||||
|
# --no-deps \
|
||||||
|
# /src
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# Build: podman build -t localhost/python-ci -f Containerfile.ci
|
|
||||||
FROM localhost/trixie_python
|
|
||||||
|
|
||||||
RUN apt-get -y --no-install-recommends install nodejs git python3-pytest && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/listsd/* && \
|
|
||||||
rm -rf /root/.cache
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
FROM localhost/trixie_python AS build
|
# Build: podman build -t treetrail-backend-deps -f Containerfile.deps
|
||||||
|
|
||||||
ENV PATH=/app/bin:$PATH
|
FROM localhost/trixie_python
|
||||||
|
|
||||||
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
|
COPY ./pyproject.toml ./README.md ./uv.lock /_lock/
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ WORKDIR /app
|
||||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
|
|
||||||
COPY --from=tiptop:5000/treetrail_backend_deps /app /app
|
COPY --from=tiptop:5000/treetrail_backend_deps /app /app
|
||||||
COPY --from=tiptop:5000/treetrail_backend_deps /var/lib/treetrail/ /var/lib/treetrail
|
#COPY --from=tiptop:5000/treetrail_backend_deps /var/lib/treetrail/ /var/lib/treetrail
|
||||||
COPY ./treetrail ./pyproject.toml ./README.md ./
|
COPY ./treetrail ./pyproject.toml ./README.md ./
|
||||||
|
|
||||||
# Instances should override the prod.yaml file
|
# Instances should override the prod.yaml file
|
||||||
|
|
62
build.yaml
Normal file
62
build.yaml
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
- name: Build containers
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
force: false
|
||||||
|
force_rm: false
|
||||||
|
cache: false
|
||||||
|
repository: tiptop:5000
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
#- name: Read conf
|
||||||
|
# ansible.builtin.include_vars:
|
||||||
|
# file: prod.yaml
|
||||||
|
# name: conf
|
||||||
|
|
||||||
|
- name: Using the variables
|
||||||
|
ansible.builtin.debug:
|
||||||
|
var: force_rm
|
||||||
|
|
||||||
|
- name: Build the base image, only with python dependencies
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: treetrail-backend-deps
|
||||||
|
state: build
|
||||||
|
path: "{{ playbook_dir }}"
|
||||||
|
build:
|
||||||
|
format: oci
|
||||||
|
force_rm: "{{ force_rm }}"
|
||||||
|
cache: "{{ cache }}"
|
||||||
|
file: Containerfile.deps
|
||||||
|
push: true
|
||||||
|
push_args:
|
||||||
|
dest: "{{ repository }}/treetrail-backend-deps"
|
||||||
|
|
||||||
|
- name: Build a backend base container image, with sources in /src
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: treetrail-backend-base
|
||||||
|
state: build
|
||||||
|
force: "{{ force }}"
|
||||||
|
path: "{{ playbook_dir }}"
|
||||||
|
build:
|
||||||
|
format: oci
|
||||||
|
force_rm: "{{ force_rm }}"
|
||||||
|
cache: "{{ cache }}"
|
||||||
|
file: Containerfile.base
|
||||||
|
push: true
|
||||||
|
push_args:
|
||||||
|
dest: "{{ repository }}/treetrail-backend-base"
|
||||||
|
|
||||||
|
- name: Build the prod container image
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: treetrail-backend
|
||||||
|
state: build
|
||||||
|
force: "{{ force }}"
|
||||||
|
path: "{{ playbook_dir }}"
|
||||||
|
build:
|
||||||
|
format: oci
|
||||||
|
force_rm: "{{ force_rm }}"
|
||||||
|
cache: "{{ cache }}"
|
||||||
|
file: Containerfile
|
||||||
|
push: true
|
||||||
|
push_args:
|
||||||
|
dest: "{{ repository }}/treetrail-backend"
|
Loading…
Add table
Add a link
Reference in a new issue