Files
finance/infra/docker/Dockerfile.backend
T
k1nq d582f15681 feat: add tests for import polling, login page, money utilities, and query keys
- Implemented tests for import polling functionality, ensuring correct behavior for active and terminal import statuses.
- Created tests for the login page, validating user interactions and error handling.
- Added unit tests for money utility functions, covering parsing, formatting, and summation of monetary values.
- Developed tests for query keys, ensuring proper scoping and invalidation roots.

chore: setup testing environment and configuration

- Added setup file for testing with Vitest and Testing Library.
- Configured TypeScript and Vite for the frontend project.
- Created Docker and Nginx configurations for local development and production environments.
- Established a PostgreSQL initialization script for setting up application roles.

docs: add README and environment configuration for infra

- Included README for the infra directory, detailing local development setup and service descriptions.
- Created an example environment configuration file for local development with placeholders for sensitive information.
2026-09-14 09:26:33 +05:00

47 lines
1.5 KiB
Docker

# Provider-neutral production image for the backend (API and Celery worker
# share one image; the worker is started with a command override).
#
# Build contract (owned with the backend team, see infra/README.md):
# - build context is backend/
# - backend/ contains pyproject.toml, uv.lock and the application package app/
# - API entrypoint: uvicorn app.main:app; health endpoint: GET /healthz
# - Celery app import path: app.worker.celery
#
# Build:
# docker build -f infra/docker/Dockerfile.backend -t finance-api:local backend
FROM python:3.12-slim-bookworm AS runtime
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/opt/venv
# Pin the uv digest before first production build; keep in sync with CI.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
# Dependencies first for layer caching. Requires uv.lock to be up to date.
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
# Application code.
COPY app ./app
COPY alembic ./alembic
COPY alembic.ini ./alembic.ini
RUN uv sync --frozen --no-dev
RUN useradd --uid 10001 --create-home --shell /usr/sbin/nologin appuser \
&& chown -R appuser:appuser /app
USER appuser
ENV PATH="/opt/venv/bin:${PATH}"
EXPOSE 8000
# API role default. Database migrations run as a one-shot release step
# (see docs/operations/beta-release-runbook.md), not on container start.
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]