Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
40 changes: 15 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
# Stage 1: Install dependencies
FROM python:3.9-alpine AS builder
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

# Install build dependencies
RUN apk add --no-cache gcc musl-dev libffi-dev openssl-dev git

# Set working directory
WORKDIR /app

# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt

# Stage 2: Final image
FROM python:3.9-alpine
ENV UV_COMPILE_BYTECODE=1

# Install runtime dependencies
RUN apk add --no-cache git
ENV UV_LINK_MODE=copy

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --frozen --no-install-project --no-dev

# Set working directory
WORKDIR /app
ADD . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev

# Copy installed dependencies from builder
COPY --from=builder /install /usr/local
ENV PATH="/app/.venv/bin:$PATH"

# Copy application code
COPY . .

# Expose port
EXPOSE 5000

# Run the application
CMD ["python", "app.py"]
ENTRYPOINT [ "uv" ]

CMD [ "run", "gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
cosmos_upgrades:
build: .
restart: unless-stopped
ports:
- "5000:5000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/healthz"]
interval: 30s
timeout: 10s
retries: 3
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[project]
name = "cosmos-upgrades"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
"dotenv>=0.9.9",
"flask==2.1.1",
"flask-caching==2.0.2",
"gunicorn==20.1.0",
"loguru>=0.7.3",
"pillow>=11.2.1",
"requests==2.26.0",
"semantic-version==2.10.0",
"urllib3==1.26.7",
"werkzeug==2.2.2",
]

[dependency-groups]
dev = [
"ruff>=0.9.4",
]

[tool.ruff]
line-length = 120
Loading