feat(CI): Usage de buildx pour faire des images multi-arch
This commit is contained in:
parent
88c7fa9a47
commit
28b8db88bf
@ -7,22 +7,19 @@ stages:
|
|||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||||
|
PLATFORM: linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
|
- docker buildx create --name mybuilder --platform "$PLATFORM"
|
||||||
|
- docker buildx use mybuilder
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
script:
|
||||||
- docker build --pull -t "$DOCKER_IMAGE_NAME" .
|
- docker buildx build --push -t "$CI_REGISTRY_IMAGE:latest" --platform "$PLATFORM" .
|
||||||
- docker push "$DOCKER_IMAGE_NAME"
|
|
||||||
- |
|
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
|
||||||
docker tag "$DOCKER_IMAGE_NAME" "$CI_REGISTRY_IMAGE:latest"
|
|
||||||
docker push "$CI_REGISTRY_IMAGE:latest"
|
|
||||||
fi
|
|
||||||
# Run this job in a branch where a Dockerfile exists
|
# Run this job in a branch where a Dockerfile exists
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_BRANCH
|
- if: $CI_COMMIT_BRANCH
|
||||||
@ -31,8 +28,6 @@ build:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
before_script:
|
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_REGISTRY_IMAGE:latest
|
- docker pull $CI_REGISTRY_IMAGE:latest
|
||||||
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||||
|
Loading…
Reference in New Issue
Block a user