Changed CI Workflow

This commit is contained in:
Phil 2022-01-06 18:00:14 +01:00
parent eb10124fb8
commit c02f91f237

View file

@ -3,7 +3,7 @@ variables:
REPO_NAME: git.ucode.space/Phil/goshorly REPO_NAME: git.ucode.space/Phil/goshorly
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
stages: stages:
- test - test
- build - build
@ -31,8 +31,8 @@ gosec:
- go get -v -d . - go get -v -d .
- gosec ./... - gosec ./...
docker-build-prod: docker-build-prod-latest:
image: docker:latest image: carlallen/docker:buildx
stage: build stage: build
services: services:
- docker:dind - docker:dind
@ -40,20 +40,13 @@ docker-build-prod:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- | - |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then docker buildx build \
tag="" --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" --push \
else --tag $CI_REGISTRY_IMAGE:latest \
tag=":$CI_COMMIT_REF_SLUG" .
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" only:
fi - main
- docker buildx create --use
- docker buildx build
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8
--tag $CI_REGISTRY_IMAGE${tag}
--push
except:
- merge_requests
docker-build-MR-dry-run: docker-build-MR-dry-run:
image: docker:latest image: docker:latest