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 cdaf4a6
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 180 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
5 changes: 1 addition & 4 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"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 @@ -4543,6 +4539,7 @@
"/oauth/disconnect/{remote_app}/": {},
"/oauth/login": {},
"/oauth/login/{remote_app}/": {},
"/oauth/logout": {},
"/oauth/signup/{remote_app}/": {},
"/oauth/static/{filename}": {},
"/signin": {},
Expand Down
5 changes: 4 additions & 1 deletion reana_server/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019, 2020, 2021 CERN.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -11,6 +11,9 @@
from reana_server.factory import create_app

# Needed for flask.with_appcontext decorator to work.
#
# Note that this is only a minimal Flask app containing REANA endpoints and the needed
# Invenio modules. See the docstring of `create_app` for more details.
app = create_app()

if __name__ == "__main__":
Expand Down
14 changes: 9 additions & 5 deletions reana_server/factory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022 CERN.
# Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022, 2024 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -11,11 +11,10 @@
import logging

from flask import Flask, current_app
from flask_babelex import Babel
from invenio_i18n 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
Expand All @@ -25,7 +24,12 @@


def create_app(config_mapping=None):
"""REANA Server application factory."""
"""REANA Server application factory.
Create a minimal Flask app containing all of REANA's endpoints and the needed
Invenio modules. Use `invenio_app.factory.create_app` the create the full Invenio
app that is also used in production or when invoking `invenio run`.
"""
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,6 +39,7 @@ def create_app(config_mapping=None):

app.session = Session

# Inspired from https://github.com/inveniosoftware/invenio-accounts/blob/345abfc2d3bf4af0be898a1b4ee1fe45edd16053/tests/conftest.py#L66
Babel(app)
FlaskMenu(app)
InvenioDB(app)
Expand All @@ -43,7 +48,6 @@ def create_app(config_mapping=None):
InvenioOAuthClient(app)

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

Expand Down
Loading

0 comments on commit cdaf4a6

Please sign in to comment.