Skip to content

Commit 740ad9a

Browse files
authored
build: upgrades used base docker image to Ubuntu 24.04. (#244)
1 parent 19ba2f0 commit 740ad9a

File tree

19 files changed

+345
-299
lines changed

19 files changed

+345
-299
lines changed

.github/workflows/check_n_push_image.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,26 @@ on:
1919

2020
jobs:
2121
check-code:
22-
runs-on: ubuntu-22.04
22+
runs-on: ubuntu-24.04
2323

2424
steps:
2525
- uses: actions/checkout@v4
26-
- name: Set up Python 3.10
26+
- name: Set up Python 3.12
2727
uses: actions/setup-python@v5
2828
with:
29-
python-version: '3.10'
29+
python-version: '3.12'
3030

3131
- name: Lint with ruff and pyright
3232
run: |
3333
make substitute-sources
3434
pip install $(python3 setup.py --install-requirements)
3535
pip install $(python3 setup.py --build-requirements)
36+
pip install $(python3 setup.py --lint-requirements)
3637
pip install --requirement docs/notebooks/requirements.txt
37-
pip install pre-commit==4.3.0
3838
make pre-commit
3939
4040
docker-build-test-autotest:
41-
runs-on: ubuntu-22.04
41+
runs-on: ubuntu-24.04
4242
steps:
4343
- uses: actions/checkout@v4
4444

@@ -56,13 +56,13 @@ jobs:
5656
- name: Get current util version
5757
id: get_version
5858
run: |
59-
echo "::set-output name=version::$(grep --max-count 1 UTIL_VERSION Makefile | grep -Eo "[0-9]+[.][0-9]+[.][0-9]+")"
59+
echo "::set-output name=version::$(grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml)"
6060
6161
- name: Create main docker image, run tests and save image for the next job
6262
run: |
6363
export $(cat .env | xargs)
64-
make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
65-
docker image save --output /tmp/codeplag-ubuntu22.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }}
64+
make docker-image DOCKER_TAG=${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }}
65+
docker image save --output /tmp/codeplag-ubuntu24.04.tar ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }}
6666
6767
- name: Pytest coverage comment
6868
uses: MishaKav/pytest-coverage-comment@v1
@@ -86,13 +86,13 @@ jobs:
8686
if: ${{ startsWith(github.event.ref, 'refs/tags/v') }}
8787
uses: actions/upload-artifact@v4
8888
with:
89-
name: codeplag-ubuntu22.04
90-
path: /tmp/codeplag-ubuntu22.04.tar
89+
name: codeplag-ubuntu24.04
90+
path: /tmp/codeplag-ubuntu24.04.tar
9191
retention-days: 1
9292
if-no-files-found: error
9393

9494
push-image:
95-
runs-on: ubuntu-22.04
95+
runs-on: ubuntu-24.04
9696
needs: [check-code, docker-build-test-autotest]
9797
if: startsWith(github.event.ref, 'refs/tags/v')
9898

@@ -103,7 +103,7 @@ jobs:
103103
- name: Download created in the previous stage image
104104
uses: actions/download-artifact@v4
105105
with:
106-
name: codeplag-ubuntu22.04
106+
name: codeplag-ubuntu24.04
107107
path: /tmp
108108

109109
- name: Get current util version
@@ -113,8 +113,8 @@ jobs:
113113
114114
- name: Load Docker created image
115115
run: |
116-
docker load --input /tmp/codeplag-ubuntu22.04.tar
117-
docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04:latest
116+
docker load --input /tmp/codeplag-ubuntu24.04.tar
117+
docker image tag ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:${{ steps.get_version.outputs.version }} ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04:latest
118118
119119
- name: Login to Docker Hub
120120
uses: docker/login-action@v3
@@ -123,4 +123,4 @@ jobs:
123123
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
124124

125125
- name: Push docker image
126-
run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu22.04
126+
run: docker image push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/codeplag-ubuntu24.04

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
default_language_version:
2-
python: python3.10
2+
python: python3.12
33
repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.14.2
5+
rev: v0.14.3
66
hooks:
77
- id: ruff
88
args: [ --fix ]

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ First of all thank you for your desire to contribute in that project.
44

55
## Development environment
66

7-
Before starting work with this project you need to install [Python 3.10](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test').
7+
Before starting work with this project you need to install [Python 3.12](https://www.python.org/), [Docker](https://www.docker.com/) (for commands like 'make docker-test').
88

99
After that you'll need to install and setup pre-commit hooks for checking style of source code, formatting it and checking types:
1010

Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
UTIL_VERSION := 0.5.30
2-
UTIL_NAME := codeplag
3-
PWD := $(shell pwd)
1+
UTIL_VERSION := $(shell grep -Po '^version\s*=\s*"\K[\d.]+' pyproject.toml)
2+
UTIL_NAME := $(shell grep -Po '^name\s*=\s*"\K\w+' pyproject.toml)
43

54
USER_UID ?= $(shell id --user)
65
USER_GID ?= $(shell id --group)
76

8-
BASE_DOCKER_VERSION := 1.3
9-
DIST := ubuntu22.04
10-
BASE_DOCKER_TAG := $(shell echo $(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION))
11-
TEST_DOCKER_TAG := $(shell echo $(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION))
12-
DOCKER_TAG ?= $(shell echo $(UTIL_NAME)-${DIST}:$(UTIL_VERSION))
7+
BASE_DOCKER_VERSION := 1.0
8+
DIST := ubuntu24.04
9+
BASE_DOCKER_TAG := "$(UTIL_NAME)-base-${DIST}:$(BASE_DOCKER_VERSION)"
10+
TEST_DOCKER_TAG := "$(UTIL_NAME)-test-${DIST}:$(UTIL_VERSION)"
11+
DOCKER_TAG ?= "$(UTIL_NAME)-${DIST}:$(UTIL_VERSION)"
1312

1413
PYTHONDONTWRITEBYTECODE := "1"
1514
PYTHONPATH := $(PWD)/src/:$(PWD)/test/auto
@@ -85,7 +84,9 @@ install: substitute-sources man translate-compile
8584

8685
@echo "Cleaning unnecessary files after Cython compilation in $(PY_INSTALL_PATH)"
8786
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.py' -exec rm --force '{}' +
87+
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.c' -exec rm --force '{}' +
8888
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)" -type d -iname "__pycache__" -exec rm --recursive --force '{}' +
89+
find "$(DESTDIR)/$(PY_INSTALL_PATH)/webparsers" -type d -iname "__pycache__" -exec rm --recursive --force '{}' +
8990

9091
@echo "Cleaning unnecessary temporary Python files after installation in $(PY_INSTALL_PATH)"
9192
find "$(DESTDIR)/$(PY_INSTALL_PATH)/$(UTIL_NAME)/" -type f -name '*.tmp.py' -exec rm --force '{}' +

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Program for finding plagiarism in the source code written in Python 3, C, and C+
5050
### 1.3 Install with package manager apt-get
5151

5252
- Requirements:
53-
- OS Ubuntu Linux == 22.04
54-
- Python version == 3.10
53+
- OS Ubuntu Linux == 24.04
54+
- Python version == 3.12
5555

5656
- For this purpose, you need to get installing package from releases [tab](https://github.com/OSLL/code-plagiarism/releases) with extension .deb;
5757
- The next step is run commands on the target system:
@@ -81,8 +81,8 @@ If you want to use MongoDB cache for saving reports and works metadata, complete
8181
# Before local checking, you need to install dependencies into your virtual environment.
8282
$ python3 -m pip install --requirement docs/notebooks/requirements.txt
8383
$ python3 -m pip install $(python3 -m setup.py --build-requirements)
84+
$ python3 -m pip install $(python3 -m setup.py --lint-requirements)
8485
$ python3 -m pip install $(python3 -m setup.py --install-requirements)
85-
$ python3 -m pip install pre-commit==4.3.0
8686
$ make pre-commit
8787
```
8888

debian/control.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Build-Depends: debhelper (>= 10)
66

77
Package: @UTIL_NAME@-util
88
Architecture: any
9-
Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.10), python3-pip (>= 19.0),
10-
clang, libncurses5, man
9+
Depends: ${shlibs:Depends}, ${misc:Depends}, python3 (>= 3.12), python3-pip (>= 19.0),
10+
clang, libncurses6, man
1111
Description: Program for finding plagiarism in the source code written on Python3, C, C++ based on compare AST metadata.

debian/preinst.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
echo "Pre installation ($@) ..."
44

5-
pip3 install @PYTHON_REQUIRED_LIBS@
5+
pip3 install --break-system-packages @PYTHON_REQUIRED_LIBS@
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

33
ARG PYTHON_REQUIRED_LIBS
44
ARG UTIL_NAME
@@ -9,13 +9,18 @@ RUN if [ "$(dpkg-divert --truename /usr/bin/man)" = "/usr/bin/man.REAL" ]; then
99
dpkg-divert --quiet --remove --rename /usr/bin/man; \
1010
fi
1111
RUN apt-get update
12-
RUN apt-get install -y python3-pip
13-
RUN pip3 install --upgrade setuptools
14-
RUN apt-get install -y clang libncurses5
15-
RUN apt-get install -y man
16-
RUN apt-get install -y vim nano less
12+
RUN apt-get install -y --no-install-recommends \
13+
python3-pip \
14+
clang \
15+
libncurses6 \
16+
vim \
17+
nano \
18+
less
19+
RUN apt-get clean
1720

18-
RUN pip3 install $PYTHON_REQUIRED_LIBS
21+
RUN pip3 install --break-system-packages $PYTHON_REQUIRED_LIBS
22+
23+
RUN rm --recursive --force /tmp/* /var/tmp/*
1924

2025
VOLUME /usr/src/works
2126
WORKDIR /usr/src/$UTIL_NAME
File renamed without changes.

docker/docker.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ docker-base-image: substitute-sources substitute-docker
2828
--tag "$(BASE_DOCKER_TAG)" \
2929
--build-arg PYTHON_REQUIRED_LIBS="$(PYTHON_REQUIRED_LIBS)" \
3030
--build-arg UTIL_NAME="$(UTIL_NAME)" \
31-
--file docker/base_ubuntu2204.dockerfile \
31+
--file docker/base_ubuntu2404.dockerfile \
3232
. \
3333
)
3434

@@ -42,7 +42,7 @@ docker-test-image: docker-base-image
4242
--build-arg PYTHON_BUILD_LIBS="$(PYTHON_BUILD_LIBS)" \
4343
--build-arg LOGS_PATH="$(LOGS_PATH)" \
4444
--build-arg UTIL_NAME="$(UTIL_NAME)" \
45-
--file docker/test_ubuntu2204.dockerfile \
45+
--file docker/test_ubuntu2404.dockerfile \
4646
.
4747

4848
.PHONY: docker-test-mongo-run
@@ -109,7 +109,7 @@ docker-image: docker-base-image docker-test-image
109109
--build-arg UTIL_NAME="$(UTIL_NAME)" \
110110
--build-arg DEBIAN_PACKAGES_PATH="$(DEBIAN_PACKAGES_PATH)" \
111111
--build-arg DEB_PKG_NAME="$(DEB_PKG_NAME)" \
112-
--file docker/ubuntu2204.dockerfile \
112+
--file docker/ubuntu2404.dockerfile \
113113
. \
114114
)
115115

0 commit comments

Comments
 (0)