Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
conda-container-howto
Manage
Activity
Members
Labels
Plan
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
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
Quang tru HUYNH
conda-container-howto
Commits
269f957c
Commit
269f957c
authored
3 years ago
by
Quang tru HUYNH
Browse files
Options
Downloads
Patches
Plain Diff
03
parent
6eb69dbd
No related branches found
No related tags found
No related merge requests found
Pipeline
#65813
failed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+20
-0
20 additions, 0 deletions
.gitlab-ci.yml
03-gitlab-CI.md
+40
-0
40 additions, 0 deletions
03-gitlab-CI.md
with
60 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
20
−
0
View file @
269f957c
image
:
registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:latest
services
:
-
registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
stages
:
-
build
build
:
stage
:
build
script
:
-
docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" registry-gitlab.pasteur.fr
-
docker build --pull -f Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" .
-
docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME"
-
docker tag "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
-
docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
-
docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest"
-
docker push "$CI_REGISTRY_IMAGE:latest"
-
export MY_TIME=`date +"%F-%H%M"`
-
docker tag "$CI_REGISTRY_IMAGE:latest" "$CI_REGISTRY_IMAGE:$MY_TIME"
-
docker push "$CI_REGISTRY_IMAGE:$MY_TIME"
This diff is collapsed.
Click to expand it.
03-gitlab-CI.md
0 → 100644
+
40
−
0
View file @
269f957c
## Problem statement:
-
I want to use gitlab to build my docker image and use it with singularity on maestro
## Assumptions:
-
singularity module on maestro (just
`module load singularity`
)
-
gitlab docker registry which is hosting the image built from the Dockerfile
## Howto
-
create/copy/adapt the .gitlab-ci.yml file
.gitlab-ci.yml
```
image: registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:latest
services:
- registry-gitlab.pasteur.fr/dsi-tools/docker-images/docker:dind
stages:
- build
build:
stage: build
script:
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" registry-gitlab.pasteur.fr
- docker build --pull -f Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" .
- docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME"
- docker tag "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA"
- docker tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA" "$CI_REGISTRY_IMAGE:latest"
- docker push "$CI_REGISTRY_IMAGE:latest"
- export MY_TIME=`date +"%F-%H%M"`
- docker tag "$CI_REGISTRY_IMAGE:latest" "$CI_REGISTRY_IMAGE:$MY_TIME"
- docker push "$CI_REGISTRY_IMAGE:$MY_TIME"
```
## Caveats
-
docker registry is rate limited
-
gitlab.pasteur.fr is using a proxy cache to avoid hitting the limit
-
you can use the campus registry to keep a copy of your OS base image
-
the default time limit is 1h, you can change at Settings -> CI/CD -> Timeout
-
uploading to the campus registry takes time (10 GB/hour)
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