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 @@ ...@@ -11,8 +11,8 @@
# for the default branch and all other (MR) branches. # for the default branch and all other (MR) branches.
stages: stages:
- build - build
- deploy - deploy
variables: variables:
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
...@@ -27,7 +27,7 @@ build: ...@@ -27,7 +27,7 @@ build:
image: docker:dind image: docker:dind
services: services:
- name: docker:dind - 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: before_script:
- mkdir -p /mnt/volume - mkdir -p /mnt/volume
- mount /dev/vdb /mnt/volume || echo "Failed to mount /dev/vdb" - mount /dev/vdb /mnt/volume || echo "Failed to mount /dev/vdb"
...@@ -36,8 +36,12 @@ build: ...@@ -36,8 +36,12 @@ build:
- docker container prune -f || true - docker container prune -f || true
- docker network prune -f || true - docker network prune -f || true
- df -h - df -h
- free -h
- top -b -n 1
after_script: after_script:
- df -h - df -h
- free -h
- top -b -n 1
- docker system prune -a -f - docker system prune -a -f
- docker volume prune -f - docker volume prune -f
- docker container prune -f - docker container prune -f
...@@ -45,6 +49,8 @@ build: ...@@ -45,6 +49,8 @@ build:
script: script:
- docker build --cache-from=flask-backend-full --no-cache --progress=plain -t flask-backend-full -f flask_ml_api/Dockerfile . - docker build --cache-from=flask-backend-full --no-cache --progress=plain -t flask-backend-full -f flask_ml_api/Dockerfile .
- df -h - df -h
- free -h
- top -b -n 1
- docker save -o /mnt/volume/flask-backend-full.tar flask-backend-full - docker save -o /mnt/volume/flask-backend-full.tar flask-backend-full
artifacts: artifacts:
paths: paths:
...@@ -53,7 +59,7 @@ build: ...@@ -53,7 +59,7 @@ build:
key: build-cache key: build-cache
paths: paths:
- /mnt/volume - /mnt/volume
timeout: 1h timeout: 2h # Увеличиваем таймаут до 2 часов
deploy: deploy:
stage: deploy stage: deploy
...@@ -62,9 +68,11 @@ deploy: ...@@ -62,9 +68,11 @@ deploy:
image: docker:dind image: docker:dind
services: services:
- name: docker:dind - 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: before_script:
- df -h - df -h
- free -h
- top -b -n 1
- docker load -i /mnt/volume/flask-backend-full.tar - docker load -i /mnt/volume/flask-backend-full.tar
script: script:
- docker run -d flask-backend-full - 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