Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
Website
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
Service Desk
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
Jonas Leder
Website
Commits
ccfb3173
Commit
ccfb3173
authored
3 years ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
Cross compile docker for arm and arm64
parent
bc986d75
No related branches found
No related tags found
No related merge requests found
Pipeline
#6940
passed
3 years ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+5
-7
5 additions, 7 deletions
.gitlab-ci.yml
with
5 additions
and
7 deletions
.gitlab-ci.yml
+
5
−
7
View file @
ccfb3173
docker-build
:
docker-build
:
# Use the official docker image.
image
:
gitlab.jonasled.de/jonasled/buildx-docker:latest
image
:
docker:latest
stage
:
build
stage
:
build
services
:
services
:
-
docker:dind
-
docker:dind
before_script
:
before_script
:
-
docker context create build
-
docker buildx create build --use
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
script
:
script
:
-
|
-
|
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
...
@@ -17,8 +16,7 @@ docker-build:
...
@@ -17,8 +16,7 @@ docker-build:
tag=":$CI_COMMIT_REF_SLUG"
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
fi
-
docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
-
docker buildx build --platform linux/amd64,linux/arm,linux/arm64 --push --tag "$CI_REGISTRY_IMAGE${tag}" .
-
docker push "$CI_REGISTRY_IMAGE${tag}"
# 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
...
...
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