Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Init Elements
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Workers
Init Elements
Commits
6e8a56f5
Commit
6e8a56f5
authored
11 months ago
by
Yoann Schneider
Browse files
Options
Downloads
Plain Diff
Merge branch 'docker-latest' into 'master'
Push an image tagged `latest` Closes
#3
See merge request
!3
parents
3649e8b3
cca67315
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!3
Push an image tagged `latest`
Pipeline
#172865
passed
10 months ago
Stage: test
Stage: build
Stage: release
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ci/build.sh
+8
-1
8 additions, 1 deletion
ci/build.sh
with
8 additions
and
1 deletion
ci/build.sh
+
8
−
1
View file @
6e8a56f5
...
...
@@ -3,6 +3,7 @@
# Requires CI_PROJECT_DIR and CI_REGISTRY_IMAGE to be set.
# Will automatically login to a registry if CI_REGISTRY, CI_REGISTRY_USER and CI_REGISTRY_PASSWORD are set.
# Will only push an image if $CI_REGISTRY is set.
# Will also push an image if $CI_COMMIT_BRANCH and $CI_DEFAULT_BRANCH are set and equal.
if
[
-z
"
$VERSION
"
-o
-z
"
$CI_PROJECT_DIR
"
-o
-z
"
$CI_REGISTRY_IMAGE
"
]
;
then
echo
Missing environment variables
...
...
@@ -17,6 +18,12 @@ docker build -f Dockerfile . -t "$IMAGE_TAG"
if
[
-n
"
$CI_REGISTRY
"
-a
-n
"
$CI_REGISTRY_USER
"
-a
-n
"
$CI_REGISTRY_PASSWORD
"
]
;
then
echo
$CI_REGISTRY_PASSWORD
| docker login
-u
$CI_REGISTRY_USER
--password-stdin
$CI_REGISTRY
docker push
$IMAGE_TAG
if
[
-n
"
$CI_COMMIT_BRANCH
"
-a
-n
"
$CI_DEFAULT_BRANCH
"
-a
"
$CI_COMMIT_BRANCH
"
=
"
$CI_DEFAULT_BRANCH
"
]
;
then
IMAGE_TAG_LATEST
=
"
$CI_REGISTRY_IMAGE
:latest"
docker tag
$IMAGE_TAG
$IMAGE_TAG_LATEST
docker push
$IMAGE_TAG_LATEST
fi
else
echo
"Missing environment variables to log in to the container registry…"
fi
fi
\ 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