-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker_update.sh
executable file
·28 lines (19 loc) · 858 Bytes
/
docker_update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Get the version number from user input
version=$1
# Delete all Docker images with the same name and different version
docker images | grep "docker-registry.services.opix.ai/aggregator" | grep -v "$version" | awk '{print $1 ":" $2}' | xargs -r docker rmi -f
# Activate Poetry virtual environment
source $(poetry env info --path)/bin/activate
# Freeze dependencies using pip
pip freeze > requirements.txt
# Add changes to git
git add .
# Run pre-commit hooks
pre-commit run
# Commit changes with the given version number
git commit -m "new commit with version $version"
# Build the Docker image with the given version number
docker build --file docker/aggregator.Dockerfile -t docker-registry.services.opix.ai/aggregator:$version .
# Push the Docker image to the registry
docker push docker-registry.services.opix.ai/aggregator:$version