Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LakeDropsDrupalDev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
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
Docker
LakeDropsDrupalDev
Commits
7daa4492
Commit
7daa4492
authored
6 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
#12
Proper versions for script and images at the same time
parent
7f1e8b3f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+22
-9
22 additions, 9 deletions
.gitlab-ci.yml
Dockerfile
+2
-1
2 additions, 1 deletion
Dockerfile
l3d
+40
-20
40 additions, 20 deletions
l3d
with
64 additions
and
30 deletions
.gitlab-ci.yml
+
22
−
9
View file @
7daa4492
variables
:
VERSION
:
${CI_COMMIT_TAG}
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
l3d-script
:
stage
:
build
script
:
sed -i -e "s/'{{ version }}'/${VERSION}/g" l3d
artifacts
:
name
:
l3d
paths
:
-
l3d
only
:
-
tags
php-7.0
:
stage
:
build
script
:
-
docker build --pull --build-arg PHP_VERSION=7.0 -t $CI_REGISTRY_IMAGE
:
php-7.0 .
-
docker push $CI_REGISTRY_IMAGE
:
php-7.0
-
docker build --pull --build-arg PHP_VERSION=7.0
--build-arg VERSION=${VERSION}
-t $
{
CI_REGISTRY_IMAGE
}/
php-7.0
:${VERSION}
.
-
docker push $
{
CI_REGISTRY_IMAGE
}/
php-7.0
:${VERSION}
only
:
-
master
-
tags
php-7.1
:
stage
:
build
script
:
-
docker build --pull --build-arg PHP_VERSION=7.1 -t $CI_REGISTRY_IMAGE
:
php-7.1 .
-
docker push $CI_REGISTRY_IMAGE
:
php-7.1
-
docker build --pull --build-arg PHP_VERSION=7.1
--build-arg VERSION=${VERSION}
-t $
{
CI_REGISTRY_IMAGE
}/
php-7.1
:${VERSION}
.
-
docker push $
{
CI_REGISTRY_IMAGE
}/
php-7.1
:${VERSION}
only
:
-
master
-
tags
php-7.2
:
stage
:
build
script
:
-
docker build --pull --build-arg PHP_VERSION=7.2 -t $CI_REGISTRY_IMAGE
:
php-7.2 .
-
docker push $CI_REGISTRY_IMAGE
:
php-7.2
-
docker build --pull --build-arg PHP_VERSION=7.2
--build-arg VERSION=${VERSION}
-t $
{
CI_REGISTRY_IMAGE
}/
php-7.2
:${VERSION}
.
-
docker push $
{
CI_REGISTRY_IMAGE
}/
php-7.2
:${VERSION}
only
:
-
master
-
tags
This diff is collapsed.
Click to expand it.
Dockerfile
+
2
−
1
View file @
7daa4492
ARG
PHP_VERSION
ARG
VERSION
FROM
registry.lakedrops.com/docker/gitlab-drupal-ci:php-${PHP_VERSION}
LABEL
com.example.vendor="LakeDrops" \
maintainer="juergen.haas@lakedrops.com" \
version="
1.2.2
" \
version="
${VERSION}
" \
description="Drupal development environment from LakeDrops."
ENV
LAKEDROPS_DEV_ENV 1
...
...
This diff is collapsed.
Click to expand it.
l3d
+
40
−
20
View file @
7daa4492
#!/usr/bin/env bash
function
help
{
VERSION
=
'{{ version }}'
function
showHelp
{
echo
"L3D - LakeDropsDrupalDev"
echo
"========================="
echo
""
echo
"Version:
1.4.1
"
echo
"Version:
${
VERSION
}
"
echo
"Info and support: https://gitlab.lakedrops.com/docker/l3d"
echo
""
echo
"Usage:"
echo
" l3d [ help | selfupdate | update | PROJECTNAME]"
echo
" l3d [ help |
version |
selfupdate | update | PROJECTNAME
]"
echo
""
echo
""
}
function
selfupdate
{
function
showVersion
{
echo
"
${
VERSION
}
"
}
function
selfUpdate
{
NEWVERSION
=
$(
curl
-s
https://gitlab.lakedrops.com/api/v4/projects/282/repository/tags |
grep
-o
'[0-9]*\.[0-9]*\.[0-9]*'
|
head
-1
)
if
[[
"
$NEWVERSION
"
==
"
$VERSION
"
]]
;
then
echo
"No new version available"
return
fi
NEWSCRIPT
=
"https://gitlab.lakedrops.com/docker/l3d/-/jobs/artifacts/
${
NEWVERSION
}
/raw/l3d?job=l3d-script"
DEST
=
$(
which l3d
)
WGET
=
$(
which wget
)
CURL
=
$(
which curl
)
if
[[
-n
"
$WGET
"
]]
;
then
sudo
wget
-O
$DEST
https://gitlab.lakedrops.com/docker/l3d/raw/master/l3d
>
/dev/null 2>&1
sudo
wget
-O
$
{
DEST
}
${
NEWSCRIPT
}
>
/dev/null 2>&1
elif
[[
-n
"
$CURL
"
]]
;
then
sudo
curl
-o
$DEST
https://gitlab.lakedrops.com/docker/l3d/raw/master/l3d
>
/dev/null 2>&1
sudo
curl
-o
$
{
DEST
}
${
NEWSCRIPT
}
>
/dev/null 2>&1
else
echo
"Could't find wget or curl to perform the update!"
exit
1
fi
sudo chmod
+x
$DEST
sudo chmod
+x
$
{
DEST
}
echo
"Self update succeeded!"
}
function
update
{
get
env
IMAGEID
=
$(
docker image
ls
-q
registry.lakedrops.com/docker/l3d
:
php-
${
PHP_VERSION
}
)
function
update
Image
{
get
Config
IMAGEID
=
$(
docker image
ls
-q
registry.lakedrops.com/docker/l3d
/
php-
${
PHP_VERSION
}
:
${
VERSION
}
)
echo
"Updating the image ..."
STATUS
=
$(
docker pull registry.lakedrops.com/docker/l3d
:
php-
${
PHP_VERSION
}
)
STATUS
=
$(
docker pull registry.lakedrops.com/docker/l3d
/
php-
${
PHP_VERSION
}
:
${
VERSION
}
)
if
[[
"
$STATUS
"
==
*
"Status: Image is up to date"
*
]]
;
then
echo
"Already up to date"
else
...
...
@@ -53,7 +65,7 @@ function update {
fi
}
function
get
env
{
function
get
Config
{
if
[[
-f
".env"
]]
;
then
export
$(
cat
.env | xargs
)
>
/dev/null 2>&1
fi
...
...
@@ -76,7 +88,7 @@ function getenv {
fi
}
function
start
{
function
start
Container
{
if
[[
-n
"
${
COMPOSE_PROJECT_NAME
}
"
]]
;
then
ID
=
$(
docker container
ls
-q
-f
name
=
${
COMPOSE_PROJECT_NAME
}
_l3d
)
...
...
@@ -95,7 +107,7 @@ function start {
--volume
${
HOME
}
/.gitconfig:/root/.gitconfig
\
--workdir
/drupal
\
--restart
unless-stopped
\
registry.lakedrops.com/docker/l3d
:
php-
${
PHP_VERSION
}
registry.lakedrops.com/docker/l3d
/
php-
${
PHP_VERSION
}
:
${
VERSION
}
fi
EXISTING
=
$(
ls
-1
)
...
...
@@ -108,19 +120,26 @@ function start {
}
COMPOSE_PROJECT_NAME
=
if
[[
"
$VERSION
"
==
"{{ version }}"
]]
;
then
selfUpdate
fi
case
$1
in
help
)
help
showHelp
;;
version
)
showVersion
;;
selfupdate
)
self
u
pdate
self
U
pdate
;;
update
)
update
start
update
Image
start
Container
;;
*
)
...
...
@@ -130,8 +149,9 @@ case $1 in
COMPOSE_PROJECT_NAME
=
$1
fi
else
get
env
get
Config
fi
start
start
Container
;;
esac
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