Compare commits
No commits in common. "518ee39dac82569d466838a05d66f3f109ddcbbf" and "3e2e9df8906d9bb9420b35789a66dcb000259f03" have entirely different histories.
518ee39dac
...
3e2e9df890
3 changed files with 47 additions and 13 deletions
|
@ -1,23 +1,26 @@
|
||||||
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
FROM localhost/treetrail-backend-base
|
||||||
|
|
||||||
FROM localhost/treetrail-backend-deps
|
RUN <<EOT
|
||||||
|
groupadd -r app
|
||||||
|
useradd -r -d /app -g app -N app
|
||||||
|
mkdir /var/lib/treetrail
|
||||||
|
chown app: /var/lib/treetrail
|
||||||
|
EOT
|
||||||
|
|
||||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
COPY --from=localhost/treetrail-backend-base --chown=app:app /app /app
|
||||||
|
|
||||||
COPY . /src
|
USER app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
#RUN --mount=type=cache,target=/root/.cache \
|
# Instances should override the prod.yaml file
|
||||||
# cd /src && \
|
#COPY ./prod.yaml /etc/treetrail/prod.yaml
|
||||||
# uv sync --locked --no-dev --no-editable
|
#COPY ./dist/treetrail_backend-0.3.0.tar.gz /src/
|
||||||
|
|
||||||
RUN uv pip install \
|
#RUN uv pip install /src/treetrail_backend-0.3.0.tar.gz
|
||||||
--python=$UV_PROJECT_ENVIRONMENT \
|
|
||||||
--no-deps \
|
|
||||||
/src
|
|
||||||
|
|
||||||
CMD [ \
|
CMD [ \
|
||||||
"uvicorn", "treetrail.application:app", \
|
"uvicorn", "treetrail.application:app", \
|
||||||
"--port", "8081", \
|
"--port", "8081", \
|
||||||
#"--log-config", "/app/config/logging.yaml", \
|
#"--log-config", "/app/config/logging.yaml", \
|
||||||
"--host", "0.0.0.0" \
|
"--host", "0.0.0.0" \
|
||||||
]
|
]
|
||||||
|
|
16
Containerfile.base
Normal file
16
Containerfile.base
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
||||||
|
|
||||||
|
FROM localhost/treetrail-backend-deps
|
||||||
|
|
||||||
|
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||||
|
|
||||||
|
COPY . /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
|
17
build.yaml
17
build.yaml
|
@ -31,7 +31,22 @@
|
||||||
push_args:
|
push_args:
|
||||||
dest: "{{ repository }}/treetrail-backend-deps"
|
dest: "{{ repository }}/treetrail-backend-deps"
|
||||||
|
|
||||||
- name: Build the backend base container image
|
- name: Build a backend base container image, with sources in /src
|
||||||
|
containers.podman.podman_image:
|
||||||
|
name: treetrail-backend-base
|
||||||
|
state: build
|
||||||
|
force: true
|
||||||
|
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:
|
containers.podman.podman_image:
|
||||||
name: treetrail-backend
|
name: treetrail-backend
|
||||||
state: build
|
state: build
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue