Skip to content

Commit 734e9df

Browse files
authored
Update Docker config to install dependencies in separate service. (#590)
Also drop support for Python 3.8 and switch to Python 3.13 in development.
1 parent 6885a88 commit 734e9df

File tree

9 files changed

+63
-32
lines changed

9 files changed

+63
-32
lines changed

Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ All notable changes to this project will be documented here.
77
- Improve display of Python package installation errors when creating environment (#585)
88
- Update "setting up test environment" message with http response of status code 503 (#589)
99
- Change rlimit resource settings to apply each worker individually (#587)
10+
- Drop support for Python 3.8 (#590)
11+
- Use Python 3.13 in development (#590)
12+
- Update Docker configuration to install dependencies in a separate service (#590)
1013
- Improve error reporting with handled assertion errors (#591)
1114
- Add custom pytest markers to Python tester to record MarkUs metadata (#592)
1215
- Stop the autotester from running tests if there are errors in test settings (#593)

client/.dockerfiles/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,7 @@ FROM ubuntu:$UBUNTU_VERSION
55
RUN apt-get update -y && \
66
DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common && \
77
DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:deadsnakes/ppa && \
8-
DEBIAN_FRONTEND=noninteractive apt-get install -y python3.11 python3.11-venv
9-
10-
COPY ./requirements.txt /requirements.txt
11-
12-
RUN python3.11 -m venv /markus_venv && \
13-
/markus_venv/bin/pip install wheel && \
14-
/markus_venv/bin/pip install -r /requirements.txt
8+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3.13 python3.13-venv
159

1610
WORKDIR /app
1711

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
[ -f /markus_venv/bin/python3.13 ] || python3.13 -m venv /markus_venv
4+
5+
/markus_venv/bin/pip install -q --upgrade pip
6+
/markus_venv/bin/pip install -q wheel
7+
printf "[MarkUs] Running pip install -q -r requirements.txt..."
8+
if /markus_venv/bin/pip install -q -r requirements.txt; then
9+
printf " \e[32m✔\e[0m \n"
10+
fi
11+
12+
# Execute the provided command
13+
exec "$@"

client/requirements.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
flask==2.2.5;python_version<"3.8"
2-
flask==3.1.0;python_version>="3.8"
3-
python-dotenv==0.21.1;python_version<"3.8"
4-
python-dotenv==1.0.1;python_version>="3.8"
1+
flask==3.1.0
2+
python-dotenv==1.0.1
53
rq==2.1.0
64
redis==5.2.1
7-
jsonschema==4.17.3;python_version<"3.8"
8-
jsonschema==4.23.0;python_version>="3.8"
9-
Werkzeug==2.2.3;python_version<"3.8"
10-
Werkzeug==3.1.3;python_version>="3.8"
5+
jsonschema==4.23.0
6+
Werkzeug==3.1.3

compose.yaml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
services:
2-
server:
2+
server: &server
33
build:
44
context: ./server
55
dockerfile: ./.dockerfiles/Dockerfile
66
args:
77
UBUNTU_VERSION: '22.04'
88
LOGIN_USER: 'docker'
99
WORKSPACE: '/home/docker/.autotesting'
10-
image: markus-autotest-server-dev:1.2.0
10+
image: markus-autotest-server-dev:1.3.0
1111
volumes:
1212
- ./server:/app:cached
13+
- venv_server:/home/docker/markus_venv
1314
- workspace:/home/docker/.autotesting:rw
1415
environment:
1516
- REDIS_URL=redis://redis:6379/
@@ -22,16 +23,17 @@ services:
2223
- postgres
2324
- redis
2425

25-
client:
26+
client: &client
2627
build:
2728
context: ./client
2829
dockerfile: ./.dockerfiles/Dockerfile
2930
args:
3031
UBUNTU_VERSION: '22.04'
31-
image: markus-autotest-client-dev:1.2.0
32+
image: markus-autotest-client-dev:1.3.0
3233
container_name: 'autotest-client'
3334
volumes:
3435
- ./client:/app:cached
36+
- venv_client:/markus_venv
3537
environment:
3638
- REDIS_URL=redis://redis:6379/
3739
- FLASK_HOST=0.0.0.0
@@ -44,6 +46,20 @@ services:
4446
- default
4547
- markus_dev
4648

49+
server-deps-updater:
50+
<<: *server
51+
entrypoint: "/app/.dockerfiles/entrypoint-dev-deps-updater.sh"
52+
profiles: ["manual"] # Prevent service from starting automatically
53+
depends_on: []
54+
55+
client-deps-updater:
56+
<<: *client
57+
entrypoint: ".dockerfiles/entrypoint-dev-deps-updater.sh"
58+
profiles: ["manual"] # Prevent service from starting automatically
59+
ports: []
60+
depends_on: []
61+
networks: []
62+
4763
postgres:
4864
image: postgres:14
4965
volumes:
@@ -73,6 +89,8 @@ services:
7389
volumes:
7490
postgres_autotest:
7591
redis_autotest:
92+
venv_client:
93+
venv_server:
7694
workspace:
7795

7896
networks:

server/.dockerfiles/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ RUN chmod a+x /home/${LOGIN_USER}
4343

4444
COPY . /app
4545

46-
RUN python3.11 -m venv /markus_venv && \
47-
/markus_venv/bin/pip install wheel && \
48-
/markus_venv/bin/pip install -r /app/requirements.txt && \
49-
find /app/autotest_server/testers -name requirements.system -exec {} \; && \
50-
rm -rf /app/*
46+
RUN find /app/autotest_server/testers -name requirements.system -exec {} \;
5147

5248
RUN echo "TZ=$( cat /etc/timezone )" >> /etc/R/Renviron.site
5349

5450
RUN mkdir -p ${WORKSPACE} && chown ${LOGIN_USER} ${WORKSPACE}
51+
RUN mkdir -p /home/${LOGIN_USER}/markus_venv && chown ${LOGIN_USER} /home/${LOGIN_USER}/markus_venv
5552

5653
WORKDIR /home/${LOGIN_USER}
5754

server/.dockerfiles/cmd-dev.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env bash
22

3-
/markus_venv/bin/python /app/install.py
4-
/markus_venv/bin/python /app/start_stop.py start -n
3+
markus_venv/bin/python /app/install.py
4+
markus_venv/bin/python /app/start_stop.py start -n
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
[ -f markus_venv/bin/python3.13 ] || python3.13 -m venv markus_venv
4+
5+
markus_venv/bin/pip install -q --upgrade pip
6+
markus_venv/bin/pip install -q wheel
7+
printf "[MarkUs] Running pip install -q -r /app/requirements.txt..."
8+
if markus_venv/bin/pip install -q -r /app/requirements.txt; then
9+
printf " \e[32m✔\e[0m \n"
10+
fi
11+
12+
# Execute the provided command
13+
exec "$@"

server/requirements.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
rq==2.1.0
22
click==8.1.8
33
redis==5.2.1
4-
pyyaml==6.0.1;python_version<"3.8"
5-
pyyaml==6.0.2;python_version>="3.8"
6-
jsonschema==4.17.3;python_version<"3.8"
7-
jsonschema==4.23.0;python_version>="3.8"
8-
requests==2.31.0;python_version<"3.8"
9-
requests==2.32.3;python_version>="3.8"
4+
pyyaml==6.0.2
5+
jsonschema==4.23.0
6+
requests==2.32.3
107
psycopg2-binary==2.9.10
118
supervisor==4.2.5

0 commit comments

Comments
 (0)