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 8, 2024
1 parent 3f716f7 commit 2b4785d
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 239 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
70 changes: 1 addition & 69 deletions reana_server/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,4 @@

"""Flask-application factory for Reana-Server."""

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


def create_app(config_mapping=None):
"""REANA Server application factory."""
logging.basicConfig(level=REANA_LOG_LEVEL, format=REANA_LOG_FORMAT, force=True)
app = Flask(__name__)
app.config.from_object("reana_server.config")
if config_mapping:
app.config.from_mapping(config_mapping)
app.secret_key = "hyper secret key"

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,
gitlab,
ping,
secrets,
status,
users,
workflows,
info,
launch,
) # noqa

app.register_blueprint(ping.blueprint, url_prefix="/api")
app.register_blueprint(workflows.blueprint, url_prefix="/api")
app.register_blueprint(users.blueprint, url_prefix="/api")
app.register_blueprint(secrets.blueprint, url_prefix="/api")
app.register_blueprint(gitlab.blueprint, url_prefix="/api")
app.register_blueprint(config.blueprint, url_prefix="/api")
app.register_blueprint(status.blueprint, url_prefix="/api")
app.register_blueprint(info.blueprint, url_prefix="/api")
app.register_blueprint(launch.blueprint, url_prefix="/api")

@app.teardown_appcontext
def shutdown_session(response_or_exc):
"""Close session on app teardown."""
current_app.session.remove()
return response_or_exc

return app
from invenio_app.factory import create_app
Loading

0 comments on commit 2b4785d

Please sign in to comment.