Container build: simplify & speed up, removing the final step running the app as a dedicated user
This commit is contained in:
parent
ae0d3532aa
commit
0f612ae3cc
3 changed files with 13 additions and 47 deletions
|
@ -1,26 +1,23 @@
|
|||
FROM localhost/treetrail-backend-base
|
||||
# Build: podman build -t treetrail-backend-base -f Containerfile.base
|
||||
|
||||
RUN <<EOT
|
||||
groupadd -r app
|
||||
useradd -r -d /app -g app -N app
|
||||
mkdir /var/lib/treetrail
|
||||
chown app: /var/lib/treetrail
|
||||
EOT
|
||||
FROM localhost/treetrail-backend-deps
|
||||
|
||||
COPY --from=localhost/treetrail-backend-base --chown=app:app /app /app
|
||||
ENV PYTHONPATH $UV_PROJECT_ENVIRONMENT/lib/python3.12/site-packages
|
||||
|
||||
USER app
|
||||
WORKDIR /app
|
||||
COPY . /src
|
||||
|
||||
# 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 --mount=type=cache,target=/root/.cache \
|
||||
# cd /src && \
|
||||
# uv sync --locked --no-dev --no-editable
|
||||
|
||||
#RUN uv pip install /src/treetrail_backend-0.3.0.tar.gz
|
||||
RUN uv pip install \
|
||||
--python=$UV_PROJECT_ENVIRONMENT \
|
||||
--no-deps \
|
||||
/src
|
||||
|
||||
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