Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
55f18bd2
Commit
55f18bd2
authored
Dec 12, 2019
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build script with docker hub push enabled
parent
0c03ffeb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
build.py
bin/build.py
+7
-4
No files found.
bin/build.py
View file @
55f18bd2
...
@@ -2,10 +2,13 @@ import os
...
@@ -2,10 +2,13 @@ import os
import
shutil
import
shutil
import
sys
import
sys
if
len
(
sys
.
argv
)
!=
2
:
raise
Exception
(
"Push to Docker Hub will not work, please provide username as argument"
)
DOCKER_COMPOSE_NAME
=
"Dockerfile"
DOCKER_COMPOSE_NAME
=
"Dockerfile"
ROOT
=
'../'
ROOT
=
'../'
SOURCEPATH
=
f
'{ROOT}src/'
SOURCEPATH
=
f
'{ROOT}src/'
DOCKER_USERNAME
=
sys
.
argv
[
1
]
paths
=
[]
paths
=
[]
for
r
,
_
,
f
in
os
.
walk
(
SOURCEPATH
):
for
r
,
_
,
f
in
os
.
walk
(
SOURCEPATH
):
...
@@ -21,18 +24,18 @@ command_args = [{'path': path,
...
@@ -21,18 +24,18 @@ command_args = [{'path': path,
res_str
=
[]
res_str
=
[]
for
command_arg
in
command_args
:
for
command_arg
in
command_args
:
path
=
command_arg
[
'path'
]
path
=
command_arg
[
'path'
]
image_name
=
command_arg
[
'name'
]
image_name
=
f
"{DOCKER_USERNAME}/{command_arg['name']}"
# copy Dockerfile into root dir to have access to modules folder
# copy Dockerfile into root dir to have access to modules folder
shutil
.
copy2
(
os
.
path
.
join
(
path
,
DOCKER_COMPOSE_NAME
),
ROOT
)
shutil
.
copy2
(
os
.
path
.
join
(
path
,
DOCKER_COMPOSE_NAME
),
ROOT
)
# build then remove Dockerfile
# build then remove Dockerfile
exit_val
=
os
.
system
(
f
"docker image build -t {image_name} {ROOT}"
)
exit_val
=
os
.
system
(
f
"docker image build -t {image_name} {ROOT}"
)
os
.
remove
(
os
.
path
.
normpath
(
ROOT
,
DOCKER_COMPOSE_NAME
))
os
.
remove
(
os
.
path
.
join
(
ROOT
,
DOCKER_COMPOSE_NAME
))
res_str
.
append
(
f
"### {image_name} built with exit code {exit_val}"
)
res_str
.
append
(
f
"### {image_name} built with exit code {exit_val}"
)
#
os.system(f"docker push {image_name}")
os
.
system
(
f
"docker push {image_name}"
)
print
(
f
"Found {len(command_args)} images"
)
print
(
f
"Found {len(command_args)} images"
)
for
s
in
res_str
:
for
s
in
res_str
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment