align dependency runtime baselines across Docker and CI

This commit is contained in:
alex wiesner
2026-03-15 15:40:40 +00:00
parent 566077533b
commit 7f03da23dd
15 changed files with 54 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
services: services:
db: db:
image: postgis/postgis:15-3.3 image: postgis/postgis:16-3.5
container_name: voyage-db container_name: voyage-db
restart: unless-stopped restart: unless-stopped
ports: ports:

View File

@@ -13,16 +13,17 @@ on:
env: env:
IMAGE_NAME: "voyage-backend" IMAGE_NAME: "voyage-backend"
PYTHON_IMAGE: "python:3.13-slim"
jobs: jobs:
upload: upload:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -48,6 +49,8 @@ jobs:
with: with:
context: ./backend context: ./backend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_IMAGE=${{ env.PYTHON_IMAGE }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:beta ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:beta

View File

@@ -15,6 +15,7 @@ on:
env: env:
IMAGE_NAME: "voyage-backend" IMAGE_NAME: "voyage-backend"
PYTHON_IMAGE: "python:3.13-slim"
jobs: jobs:
upload: upload:
@@ -50,6 +51,8 @@ jobs:
with: with:
context: ./backend context: ./backend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_IMAGE=${{ env.PYTHON_IMAGE }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:latest ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:latest

View File

@@ -10,16 +10,17 @@ on:
env: env:
IMAGE_NAME: "voyage-backend" IMAGE_NAME: "voyage-backend"
PYTHON_IMAGE: "python:3.13-slim"
jobs: jobs:
upload: upload:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -45,6 +46,8 @@ jobs:
with: with:
context: ./backend context: ./backend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
PYTHON_IMAGE=${{ env.PYTHON_IMAGE }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}

View File

@@ -15,15 +15,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: set up python 3.12 - name: set up python 3.13
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: "3.13"
- name: install dependencies - name: install dependencies
run: | run: |
sudo apt update -q sudo apt update -q
sudo apt install -y -q python3-gdal sudo apt install -y -q gdal-bin libgdal-dev
- name: start database - name: start database
run: | run: |

View File

@@ -13,16 +13,17 @@ on:
env: env:
IMAGE_NAME: "voyage-frontend" IMAGE_NAME: "voyage-frontend"
BUN_VERSION: "1.3.10"
jobs: jobs:
upload: upload:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -48,6 +49,8 @@ jobs:
with: with:
context: ./frontend context: ./frontend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
BUN_VERSION=${{ env.BUN_VERSION }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:beta ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:beta

View File

@@ -15,6 +15,7 @@ on:
env: env:
IMAGE_NAME: "voyage-frontend" IMAGE_NAME: "voyage-frontend"
BUN_VERSION: "1.3.10"
jobs: jobs:
upload: upload:
@@ -50,6 +51,8 @@ jobs:
with: with:
context: ./frontend context: ./frontend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
BUN_VERSION=${{ env.BUN_VERSION }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:latest ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:latest

View File

@@ -10,16 +10,17 @@ on:
env: env:
IMAGE_NAME: "voyage-frontend" IMAGE_NAME: "voyage-frontend"
BUN_VERSION: "1.3.10"
jobs: jobs:
upload: upload:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
@@ -45,6 +46,8 @@ jobs:
with: with:
context: ./frontend context: ./frontend
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
build-args: |
BUN_VERSION=${{ env.BUN_VERSION }}
push: true push: true
tags: | tags: |
ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} ghcr.io/${{ steps.repo_owner.outputs.repo_owner }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}

View File

@@ -17,6 +17,8 @@ jobs:
- name: setup bun - name: setup bun
uses: oven-sh/setup-bun@v2 uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.10
- name: install dependencies - name: install dependencies
working-directory: frontend working-directory: frontend

View File

@@ -41,6 +41,9 @@ jobs:
image-scan: image-scan:
name: Trivy Docker Image Scan (Backend & Frontend) name: Trivy Docker Image Scan (Backend & Frontend)
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
BUN_VERSION: "1.3.10"
PYTHON_IMAGE: "python:3.13-slim"
steps: steps:
- name: Checkout code - name: Checkout code
@@ -57,10 +60,10 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Build backend Docker image - name: Build backend Docker image
run: docker build -t voyage-backend ./backend run: docker build --build-arg PYTHON_IMAGE=${{ env.PYTHON_IMAGE }} -t voyage-backend ./backend
- name: Build frontend Docker image - name: Build frontend Docker image
run: docker build -t voyage-frontend ./frontend run: docker build --build-arg BUN_VERSION=${{ env.BUN_VERSION }} -t voyage-frontend ./frontend
- name: Scan backend Docker image with Trivy - name: Scan backend Docker image with Trivy
uses: aquasecurity/trivy-action@master uses: aquasecurity/trivy-action@master

View File

@@ -1,5 +1,6 @@
# Stage 1: Build stage with dependencies # Stage 1: Build stage with dependencies
FROM python:3.13-slim AS builder ARG PYTHON_IMAGE=python:3.13-slim
FROM ${PYTHON_IMAGE} AS builder
# Metadata labels # Metadata labels
LABEL maintainer="Voyage contributors" \ LABEL maintainer="Voyage contributors" \
@@ -35,7 +36,7 @@ RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir -r requirements.txt
# Stage 2: Final image with runtime dependencies # Stage 2: Final image with runtime dependencies
FROM python:3.13-slim FROM ${PYTHON_IMAGE}
WORKDIR /code WORKDIR /code
ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1

View File

@@ -33,5 +33,5 @@ legacy-cgi==2.6.4
requests>=2.32.5 requests>=2.32.5
cryptography>=46.0.5 cryptography>=46.0.5
django-mcp-server>=0.5.7 django-mcp-server>=0.5.7
litellm>=1.82.1 litellm>=1.82.2
duckduckgo-search>=4.0.0 duckduckgo-search>=8.1.1

View File

@@ -1,11 +1,13 @@
# Use an official Python image as a base # Use an official Python image as a base
FROM python:3.11-slim ARG PYTHON_IMAGE=python:3.13-slim
FROM ${PYTHON_IMAGE}
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
# Install required Python packages # Install required Python packages
RUN pip install --no-cache-dir requests osm2geojson COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy the script into the container # Copy the script into the container
COPY main.py /app/main.py COPY main.py /app/main.py

View File

@@ -1 +1,2 @@
osm2geojson==0.2.5 requests==2.32.5
osm2geojson==0.3.2

View File

@@ -3,6 +3,8 @@ services:
build: build:
context: ./frontend/ context: ./frontend/
target: builder target: builder
args:
BUN_VERSION: ${BUN_VERSION:-1.3.10}
# image: ghcr.io/alex-wiesner/voyage-frontend:latest # image: ghcr.io/alex-wiesner/voyage-frontend:latest
restart: unless-stopped restart: unless-stopped
user: root user: root
@@ -28,7 +30,10 @@ services:
- postgres_data:/var/lib/postgresql/data/ - postgres_data:/var/lib/postgresql/data/
server: server:
build: ./backend/ build:
context: ./backend/
args:
PYTHON_IMAGE: ${PYTHON_IMAGE:-python:3.13-slim}
# image: ghcr.io/alex-wiesner/voyage-backend:latest # image: ghcr.io/alex-wiesner/voyage-backend:latest
restart: unless-stopped restart: unless-stopped
entrypoint: [] entrypoint: []