Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DojoExerciseChecker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dojo Project (HES-SO)
Projects
Pipelines
DojoExerciseChecker
Commits
5c00a692
Commit
5c00a692
authored
1 year ago
by
michael.minelli
Browse files
Options
Downloads
Patches
Plain Diff
Add container build pipeline
parent
4ab96cbc
No related branches found
No related tags found
No related merge requests found
Pipeline
#25586
passed
1 year ago
Stage: build
Stage: release
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+60
-0
60 additions, 0 deletions
.gitlab-ci.yml
with
60 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
60
−
0
View file @
5c00a692
variables
:
GIT_SUBMODULE_STRATEGY
:
recursive
GIT_SUBMODULE_FORCE_HTTPS
:
"
true"
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
DOCKER_DRIVER
:
overlay2
DOCKERFILE
:
Dockerfile_ExerciceChecker
PLATFORMS
:
linux/amd64,linux/arm64/v8
CHECKER_PROJECT_FOLDER
:
ExerciceChecker
stages
:
-
build
-
release
default
:
tags
:
-
docker
image
:
docker:latest
services
:
-
docker:dind
before_script
:
-
apk update
-
apk add git
-
apk add jq
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker buildx create --use
-
>
VERSION=$(jq -r .version $CHECKER_PROJECT_FOLDER/package.json)
-
>
CONTAINER_IMAGE=$CI_REGISTRY_IMAGE:$VERSION-dev
build
:
stage
:
build
tags
:
-
build
script
:
-
apk add curl
-
curl --silent "https://gitlab.com/gitlab-org/incubation-engineering/mobile-devops/download-secure-files/-/raw/main/installer" | sh
-
mv .secure_files/env $CHECKER_PROJECT_FOLDER/.env
# Need to build for each platform separately because of multi-stage builds (docker buildx don't use cache same way as docker build)
-
>
platform_array=$(echo $PLATFORMS | tr "," "\n");
for platform in $platform_array; do
echo "Buildind for : $platform"
docker buildx build --pull --platform $platform --file $DOCKERFILE --tag $CONTAINER_IMAGE .
done
# Here docker buildx can use cached images created in previous step
-
docker buildx build --platform $PLATFORMS --file $DOCKERFILE --push --tag $CONTAINER_IMAGE .
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"main"
||
$CI_COMMIT_BRANCH
=~
/^v_[0-9]+(\.[0-9]+)*$/
||
$CI_COMMIT_TAG
=~
/^v_[0-9]+(\.[0-9]+)*$/'
release-image
:
stage
:
release
tags
:
-
release
script
:
-
docker buildx imagetools create $CONTAINER_IMAGE --tag $CI_REGISTRY_IMAGE:$VERSION
-
docker buildx imagetools create $CONTAINER_IMAGE --tag $CI_REGISTRY_IMAGE:latest
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"main"'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment