Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
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
Model registry
Operate
Environments
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
1e0163a4
Unverified
Commit
1e0163a4
authored
5 years ago
by
Michael Kriese
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
chore(ci): add docker cache (#5445)
parent
3de1b6e9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.github/workflows/dockerimages.yml
+41
-9
41 additions, 9 deletions
.github/workflows/dockerimages.yml
.github/workflows/release.yml
+99
-0
99 additions, 0 deletions
.github/workflows/release.yml
with
140 additions
and
9 deletions
.github/workflows/dockerimages.yml
+
41
−
9
View file @
1e0163a4
name
:
Docker Images CI
name
:
Docker Images CI
on
:
[
pull_request
]
on
:
push
:
branches
:
-
master
pull_request
:
env
:
env
:
PLATFORM
:
linux/amd64
PLATFORM
:
linux/amd64
# TODO: Replace with renovate/renovate
DOCKER_REPO
:
renovate/cache-test
jobs
:
jobs
:
build
:
build
:
name
:
Build image
name
:
Build image
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
timeout-minutes
:
20
strategy
:
strategy
:
matrix
:
matrix
:
file
:
[
Dockerfile
,
Dockerfile.slim
]
tag
:
[
latest
,
slim
]
env
:
DOCKER_FILE
:
Dockerfile.${{ matrix.tag }}
DOCKER_TAG
:
${{ matrix.tag }}
steps
:
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Overwrite env for latest tag
with
:
if
:
matrix.tag == 'latest'
fetch-depth
:
1
run
:
|
echo "::set-env name=DOCKER_FILE::Dockerfile"
-
name
:
Set up Docker Buildx
-
name
:
Set up Docker Buildx
id
:
buildx
id
:
buildx
...
@@ -25,16 +39,34 @@ jobs:
...
@@ -25,16 +39,34 @@ jobs:
with
:
with
:
version
:
v0.3.1
version
:
v0.3.1
-
uses
:
actions/checkout@v2
-
name
:
Build the Docker image
-
name
:
Build the Docker image
run
:
|
run
:
|
docker buildx build \
docker buildx build \
--platform ${PLATFORM} \
--platform ${PLATFORM} \
--output "type=docker" \
--output=type=docker \
--tag renovate \
--cache-from=${DOCKER_REPO}:cache-${DOCKER_TAG} \
--file ./${{ matrix.file }} .
--tag=renovate \
--file=./${DOCKER_FILE} .
-
name
:
Test the Docker image
run
:
|
docker run --rm -t renovate --version
-
name
:
Image history
-
name
:
Image history
run
:
docker history renovate
run
:
docker history renovate
-
name
:
Image size
-
name
:
Image size
run
:
docker image ls | grep renovate
run
:
docker image ls | grep renovate
-
name
:
Push the Docker image
if
:
github.event_name == 'push' && github.ref == 'refs/heads/master'
run
:
|
echo "${{ secrets.DOCKER_RENOVATERELEASE_TOKEN }}" | docker login -u renovaterelease --password-stdin
docker buildx build \
--platform ${PLATFORM} \
--output=type=registry \
--cache-from=${DOCKER_REPO}:cache-${DOCKER_TAG} \
--cache-to=${DOCKER_REPO}:cache-${DOCKER_TAG} \
--tag=${DOCKER_REPO}:test-${DOCKER_TAG} \
--file=./${DOCKER_FILE} .
This diff is collapsed.
Click to expand it.
.github/workflows/release.yml
0 → 100644
+
99
−
0
View file @
1e0163a4
name
:
Release CI
on
:
push
:
tags
:
-
'
[0-9]+.[0-9]+.[0-9]+'
env
:
PLATFORM
:
linux/amd64
# TODO: Replace with renovate/renovate
DOCKER_REPO
:
renovate/cache-test
jobs
:
docker-release
:
runs-on
:
ubuntu-latest
timeout-minutes
:
30
strategy
:
matrix
:
tag
:
[
latest
,
slim
]
env
:
DOCKER_FILE
:
Dockerfile.${{ matrix.tag }}
DOCKER_TAG
:
${{ matrix.tag }}
steps
:
-
name
:
Overwrite env for latest tag
if
:
matrix.tag == 'latest'
run
:
|
echo "::set-env name=DOCKER_FILE::Dockerfile"
-
name
:
Set up Docker Buildx
id
:
buildx
uses
:
crazy-max/ghaction-docker-buildx@v1
with
:
version
:
v0.3.1
-
uses
:
actions/checkout@v2
-
name
:
Build the Docker image
run
:
|
docker buildx build \
--platform ${PLATFORM} \
--output=type=docker \
--cache-from=${DOCKER_REPO}:cache-${DOCKER_TAG} \
--tag=renovate \
--file=./${DOCKER_FILE} .
-
name
:
Test the Docker image
run
:
|
docker run --rm -t renovate --version
-
name
:
Image history
run
:
docker history renovate
-
name
:
Image size
run
:
docker image ls | grep renovate
-
name
:
Generate tags
run
:
|
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Tag base
tags="${DOCKER_REPO}:${DOCKER_TAG}"
echo "Tagging ${DOCKER_REPO}:${DOCKER_TAG}"
SEMVER_REGEX="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)?$"
if ! [[ "$VERSION" =~ $SEMVER_REGEX ]]; then
echo Not a semver tag - skipping
exit 1
fi
major=${BASH_REMATCH[1]}
minor=${BASH_REMATCH[2]}
patch=${BASH_REMATCH[3]}
slim=${DOCKER_TAG#latest}
slim=${slim:+-}${slim}
# Tag for versions additional
for tag in {"${major}${slim}","${major}.${minor}${slim}","${major}.${minor}.${patch}${slim}"}; do
echo "Tagging ${DOCKER_REPO}:${tag}"
tags+=",${DOCKER_REPO}:${tag}"
done
echo "::set-env name=TAGS::${tags}"
-
name
:
Push the Docker image
run
:
|
echo "${{ secrets.DOCKER_RENOVATERELEASE_TOKEN }}" | docker login -u renovaterelease --password-stdin
docker buildx build \
--platform ${PLATFORM} \
--output=type=registry \
--cache-from=${DOCKER_REPO}:cache-${DOCKER_TAG} \
--tag=${TAGS} \
--file=./${DOCKER_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