Work on docker optimisation

This commit is contained in:
Xbird
2022-09-24 17:51:11 +00:00
parent 5db8dbe163
commit db79e18821
2 changed files with 15 additions and 2 deletions

View File

@@ -63,10 +63,14 @@ publish:
registry_img: '' registry_img: ''
before_script: before_script:
- apk add jq - apk add jq
- mkdir -p .docker
- "docker load -q -i .docker/fs.tar 2>&1 || :"
- rm -rf .docker
script: script:
- APP_VERSION=$(cat visionversion.json | jq .version -r) - APP_VERSION=$(cat visionversion.json | jq .version -r)
- docker login $registry_host -u $registry_user -p $registry_pass - docker login $registry_host -u $registry_user -p $registry_pass
- docker build -f ./Dockerfile -t $registry_host/$registry_img:$APP_VERSION . - docker build -f ./Dockerfile -t $registry_host/$registry_img:$APP_VERSION .
- docker build --cache-from=$registry_host/$registry_img -t $registry_host/$registry_img .
- docker push $registry_host/$registry_img:$APP_VERSION - docker push $registry_host/$registry_img:$APP_VERSION
- docker logout $registry_host - docker logout $registry_host
- docker login -u $docker_user -p $docker_pass - docker login -u $docker_user -p $docker_pass
@@ -74,3 +78,12 @@ publish:
- docker tag $registry_host/$registry_img:$APP_VERSION $docker_host/$docker_img - docker tag $registry_host/$registry_img:$APP_VERSION $docker_host/$docker_img
- docker push $docker_host/$docker_img:$APP_VERSION - docker push $docker_host/$docker_img:$APP_VERSION
- docker push $docker_host/$docker_img - docker push $docker_host/$docker_img
after_script:
- mkdir -p .docker
- "docker save -o .docker/fs.tar $docker_host/$docker_img 2>&1 || :"
- docker system prune -a
cache:
- key: $CI_COMMIT_REF_SLUG
paths:
- .docker
when: on_success

View File

@@ -1,3 +1,3 @@
{ {
"version": "0.2.12" "version": "0.2.13"
} }