Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jenkins-slave
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Legacy
jenkins-slave
Commits
fa661189
Commit
fa661189
authored
11 years ago
by
Erik Hedenström
Browse files
Options
Downloads
Patches
Plain Diff
Added docker-build.sh script
parent
c09ce4dc
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
install/11_docker.sh
+2
-1
2 additions, 1 deletion
install/11_docker.sh
install/docker/docker-build.sh
+37
-0
37 additions, 0 deletions
install/docker/docker-build.sh
with
39 additions
and
1 deletion
install/11_docker.sh
+
2
−
1
View file @
fa661189
...
...
@@ -4,7 +4,8 @@ set -e # Exit on errors
mkdir
-p
$JENKINS_HOME
/tools/docker/bin
curl
-s
https://get.docker.io/builds/Linux/x86_64/docker-latest
-o
$JENKINS_HOME
/tools/docker/bin/docker
chmod
755
$JENKINS_HOME
/tools/docker/bin/docker
cp
${
0
%/*
}
/docker/docker-build.sh
$JENKINS_HOME
/tools/docker/bin
chmod
755
$JENKINS_HOME
/tools/docker/bin/
*
echo
"export PATH=
$JENKINS_HOME
/tools/docker/bin:
\$
PATH"
>
/etc/profile.d/docker.sh
chmod
755 /etc/profile.d/docker.sh
This diff is collapsed.
Click to expand it.
install/docker/docker-build.sh
0 → 100644
+
37
−
0
View file @
fa661189
#!/usr/bin/env bash
set
-e
# Exit on errors
# Extract info from Dockerfile
DOCKER_REPOSITORY
=
`
grep
'^# REPOSITORY'
Dockerfile |
awk
-F
' '
'{print $3}'
`
if
[
!
${
DOCKER_REPOSITORY
:+x
}
]
;
then
DOCKER_REPOSITORY
=
`
echo
'registry.codemate.se/'
${
PWD
##*/
}
`
fi
DOCKER_TAG
=
`
grep
'^# VERSION'
Dockerfile |
awk
-F
' '
'{print $3}'
`
if
[
!
${
DOCKER_TAG
:+x
}
]
;
then
DOCKER_TAG
=
'1.0.0'
fi
# Build and publish image
docker build
-rm
-t
$DOCKER_REPOSITORY
.
docker tag
$DOCKER_REPOSITORY
$DOCKER_REPOSITORY
:
$DOCKER_TAG
docker push
$DOCKER_REPOSITORY
set
+e
# Ignore errors
# Remove stopped containers
for
CONTAINER
in
$(
docker ps
-a
|
awk
'/Exit -?[0-9]+/ { print $1 }'
)
;
do
docker
rm
$CONTAINER
done
# Remove untagged images
for
IMAGE
in
$(
docker images |
awk
'/^<none>/ { print $3 }'
)
;
do
docker rmi
$IMAGE
done
exit
0
\ 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