-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_image.py
More file actions
24 lines (19 loc) · 826 Bytes
/
build_image.py
File metadata and controls
24 lines (19 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Description: This script is used to update the version in pyproject.toml and generate the requirements.txt file.
import os
import subprocess
import toml
# Generate the requirements.txt file, excluding dev dependencies
subprocess.run(['uv', 'pip', 'freeze', '>', 'requirements.txt'], shell=True)
# Update the version in pyproject.toml
with open('pyproject.toml') as f:
data = toml.load(f)
version = data['project']['version']
version_parts = version.split('.')
version_parts[-1] = str(int(version_parts[-1]) + 1)
new_version = '.'.join(version_parts)
os.environ['VERSION_TAG'] = new_version
data['project']['version'] = new_version
with open('pyproject.toml', 'w') as f:
toml.dump(data, f)
# Build the docker image
subprocess.run(['docker', 'compose', 'up', '--build', '-d'], check=True)