Commit a8c20428 authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Image build is optimized.

parent 97c54fcf
Pipeline #10689 failed with stages
in 20 minutes and 12 seconds
......@@ -11,8 +11,8 @@
# for the default branch and all other (MR) branches.
stages:
- build
- deploy
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
......@@ -27,7 +27,7 @@ build:
image: docker:dind
services:
- name: docker:dind
command: [ "--tls=false", "--storage-driver=overlay2", "--mtu=1500", "--data-root=/mnt/volume" ]
command: ["--tls=false", "--storage-driver=overlay2", "--mtu=1500", "--data-root=/mnt/volume"]
before_script:
- mkdir -p /mnt/volume
- mount /dev/vdb /mnt/volume || echo "Failed to mount /dev/vdb"
......@@ -36,8 +36,12 @@ build:
- docker container prune -f || true
- docker network prune -f || true
- df -h
- free -h
- top -b -n 1
after_script:
- df -h
- free -h
- top -b -n 1
- docker system prune -a -f
- docker volume prune -f
- docker container prune -f
......@@ -45,6 +49,8 @@ build:
script:
- docker build --cache-from=flask-backend-full --no-cache --progress=plain -t flask-backend-full -f flask_ml_api/Dockerfile .
- df -h
- free -h
- top -b -n 1
- docker save -o /mnt/volume/flask-backend-full.tar flask-backend-full
artifacts:
paths:
......@@ -53,7 +59,7 @@ build:
key: build-cache
paths:
- /mnt/volume
timeout: 1h
timeout: 2h # Увеличиваем таймаут до 2 часов
deploy:
stage: deploy
......@@ -62,9 +68,11 @@ deploy:
image: docker:dind
services:
- name: docker:dind
command: [ "--tls=false", "--storage-driver=overlay2", "--mtu=1500", "--data-root=/mnt/volume" ]
command: ["--tls=false", "--storage-driver=overlay2", "--mtu=1500", "--data-root=/mnt/volume"]
before_script:
- df -h
- free -h
- top -b -n 1
- docker load -i /mnt/volume/flask-backend-full.tar
script:
- docker run -d flask-backend-full
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment