Skip to content

Commit

Permalink
build(docker): upgrade base image to ubuntu 24.04 (reanahub#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonadoni committed Jul 9, 2024
1 parent 3f716f7 commit 5361a5f
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 212 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on: [push, pull_request]

jobs:
lint-commitlint:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -36,7 +36,7 @@ jobs:
./run-tests.sh --check-commitlint ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}
lint-shellcheck:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -47,79 +47,79 @@ jobs:
./run-tests.sh --check-shellcheck
lint-black:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Check Python code formatting
run: |
pip install black
./run-tests.sh --check-black
lint-flake8:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Check compliance with pep8, pyflakes and circular complexity
run: |
pip install flake8
./run-tests.sh --check-flake8
lint-pydocstyle:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Check compliance with Python docstring conventions
run: |
pip install pydocstyle
./run-tests.sh --check-pydocstyle
lint-check-manifest:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Check Python manifest completeness
run: |
pip install check-manifest
./run-tests.sh --check-manifest
docs-sphinx:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Install system dependencies
run: |
Expand All @@ -135,15 +135,15 @@ jobs:
run: ./run-tests.sh --check-sphinx

python-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Install Python dependencies
run: |
Expand All @@ -163,7 +163,7 @@ jobs:
files: coverage.xml

lint-dockerfile:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -172,7 +172,7 @@ jobs:
run: ./run-tests.sh --check-dockerfile

docker-build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -181,7 +181,7 @@ jobs:
run: ./run-tests.sh --check-docker-build

release-docker:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
if: >
vars.RELEASE_DOCKER == 'true' &&
github.event_name == 'push' &&
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.8"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
# under the terms of the MIT License; see LICENSE file for more details.

# Use Ubuntu LTS base image
FROM docker.io/library/ubuntu:20.04
FROM docker.io/library/ubuntu:24.04

# Use default answers in installation commands
ENV DEBIAN_FRONTEND=noninteractive

# Use distutils provided by the standard Python library instead of the vendored one in
# setuptools, so that editable installations are stored in the right directory.
# See https://github.com/pypa/setuptools/issues/3301
ENV SETUPTOOLS_USE_DISTUTILS=stdlib
# Allow pip to install packages in the system site-packages dir
ENV PIP_BREAK_SYSTEM_PACKAGES=true

# Prepare list of Python dependencies
COPY requirements.txt /code/
Expand All @@ -27,17 +25,17 @@ RUN apt-get update -y && \
libffi-dev \
libpcre3 \
libpcre3-dev \
libpython3.8 \
libpython3.12 \
procps \
python3-pip \
python3.8 \
python3.8-dev \
python3.12 \
python3.12-dev \
vim-tiny && \
pip install --no-cache-dir --upgrade pip setuptools && \
pip install --no-cache-dir --upgrade setuptools && \
pip install --no-cache-dir -r /code/requirements.txt && \
apt-get remove -y \
gcc \
python3.8-dev && \
python3.12-dev && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -68,7 +66,7 @@ RUN if test -e modules/reana-commons; then \
fi

# A quick fix to allow eduGAIN and social login users that wouldn't otherwise match Invenio username rules
RUN sed -i 's|^username_regex = re.compile\(.*\)$|username_regex = re.compile("^\\S+$")|g' /usr/local/lib/python3.8/dist-packages/invenio_userprofiles/validators.py
RUN sed -i 's|^username_regex = re.compile\(.*\)$|username_regex = re.compile("^\\S+$")|g' /usr/local/lib/python3.12/dist-packages/invenio_userprofiles/validators.py

# Check for any broken Python dependencies
# hadolint ignore=DL3059
Expand Down
19 changes: 1 addition & 18 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"version": "0.95.0a1"
},
"paths": {
"/account/settings/linkedaccounts/": {},
"/account/settings/linkedaccounts/static/{filename}": {},
"/account/settings/login": {},
"/account/settings/security/": {},
"/account/settings/sessions/revoke/": {},
"/account/settings/static/{filename}": {},
"/api/config": {
"get": {
"description": "This resource provides configuration needed by Reana-UI.",
Expand Down Expand Up @@ -4535,18 +4529,7 @@
},
"summary": "Gets information about authenticated user."
}
},
"/confirm": {},
"/confirm/{token}": {},
"/logout/": {},
"/oauth/authorized/{remote_app}/": {},
"/oauth/disconnect/{remote_app}/": {},
"/oauth/login": {},
"/oauth/login/{remote_app}/": {},
"/oauth/signup/{remote_app}/": {},
"/oauth/static/{filename}": {},
"/signin": {},
"/signup/": {}
}
},
"swagger": "2.0"
}
35 changes: 12 additions & 23 deletions reana_server/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
import logging

from flask import Flask, current_app
from flask_babelex import Babel
from flask_menu import Menu as FlaskMenu
from flask_oauthlib.client import OAuth as FlaskOAuth
from invenio_accounts import InvenioAccounts
from invenio_accounts.views import blueprint as blueprint_user
from invenio_db import InvenioDB
from invenio_oauthclient import InvenioOAuthClient
from invenio_oauthclient.views.client import blueprint as blueprint_client
from invenio_oauthclient.views.settings import blueprint as blueprint_settings
from reana_commons.config import REANA_LOG_FORMAT, REANA_LOG_LEVEL
from reana_db.database import Session

# From Flask's point-of-view, REANA is an extension to Invenio and not a full app.
# For this reason, we propagate here `create_app` from invenio-app as this methods
# constructs a Flask app including all the features of Invenio.
from invenio_app.factory import create_app

def create_app(config_mapping=None):
"""REANA Server application factory."""

def create_reana_only_app(config_mapping=None):
"""REANA Server application factory.
Create a limited Flask app only with REANA endpoints. This is used by the script
`generate_openapi_spec.py` to automatically generate the OpenAPI specification
of REANA endpoints from their docstrings.
"""
logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT, force=True)
app = Flask(__name__)
app.config.from_object("reana_server.config")
Expand All @@ -35,18 +36,6 @@ def create_app(config_mapping=None):

app.session = Session

Babel(app)
FlaskMenu(app)
InvenioDB(app)
InvenioAccounts(app)
FlaskOAuth(app)
InvenioOAuthClient(app)

# Register Invenio OAuth endpoints
app.register_blueprint(blueprint_user)
app.register_blueprint(blueprint_client)
app.register_blueprint(blueprint_settings)

# Register API routes
from .rest import (
config,
Expand Down
Loading

0 comments on commit 5361a5f

Please sign in to comment.