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
a51448e8
Commit
a51448e8
authored
Mar 15, 2021
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adapted build.py to work with flutter projects
parent
eb70925f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
13 deletions
+44
-13
build.py
bin/build.py
+43
-12
Dockerfile
src/dashboard/Dockerfile
+1
-1
No files found.
bin/build.py
View file @
a51448e8
...
...
@@ -35,6 +35,23 @@ def get_dockerfile_paths_and_names() -> Dict[str, str]:
return
command_args
def
is_flutter_project
(
path
:
str
)
->
bool
:
test_file_path
=
f
"{path}/pubspec.yaml"
return
os
.
path
.
exists
(
test_file_path
)
class
cd
:
"""Context manager for changing the current working directory"""
def
__init__
(
self
,
newPath
):
self
.
newPath
=
os
.
path
.
expanduser
(
newPath
)
def
__enter__
(
self
):
self
.
savedPath
=
os
.
getcwd
()
os
.
chdir
(
self
.
newPath
)
def
__exit__
(
self
,
etype
,
value
,
traceback
):
os
.
chdir
(
self
.
savedPath
)
if
__name__
==
'__main__'
:
p_image_name
=
None
...
...
@@ -60,6 +77,20 @@ if __name__ == '__main__':
path
=
command_arg
[
'path'
]
image_name
=
f
"{DOCKERHUB_REPO_OWNER}/{command_arg['name']}"
if
is_flutter_project
(
path
):
with
cd
(
path
):
print
(
f
"> flutter build web"
)
os
.
system
(
f
"flutter build web"
)
print
(
f
"> docker image build -t {image_name} {path}"
)
exit_val
=
os
.
system
(
f
"docker image build -t {image_name} {path}"
)
if
exit_val
!=
0
:
error
=
exit_val
else
:
print
(
f
"> docker push {image_name}"
)
exit_val
=
os
.
system
(
f
"docker push {image_name}"
)
else
:
# copy Dockerfile into root dir to have access to modules folder
shutil
.
copy2
(
os
.
path
.
join
(
path
,
DOCKER_BUILD_NAME
),
ROOT
)
...
...
src/dashboard/Dockerfile
View file @
a51448e8
FROM
nginx:latest
EXPOSE
80
COPY
./build/web/ /usr/share/nginx/html/
\ No newline at end of file
COPY
./src/dashboard/build/web/ /usr/share/nginx/html/
\ No newline at end of file
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