Skip to content

Commit

Permalink
update docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuminjie committed Jan 4, 2021
1 parent 4c6a845 commit 68f1b24
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 44 deletions.
4 changes: 3 additions & 1 deletion openseespy-docker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
openseespy-pip
opensees
opensees
*.pyd
*.so
19 changes: 15 additions & 4 deletions openseespy-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ FROM ubuntu-petsc AS ubuntu-openseespy
ENV DEBIAN_FRONTEND=noninteractive

WORKDIR /home
COPY opensees /home/opensees
RUN git clone https://github.com/zhuminjie/OpenSees.git opensees
COPY Makefile.def /home/opensees/

RUN mkdir /home/bin && \
Expand All @@ -36,12 +36,23 @@ RUN make -j python
FROM ubuntu-openseespy AS ubuntu-pip

# Build openseespy package
COPY openseespy-pip /home/openseespy-pip/
WORKDIR /home
RUN git clone https://github.com/zhuminjie/OpenSeesPy.git openseespy

# copy windows version
# COPY opensees.pyd /home/openseespy/openseespy-pip/openseespy/opensees/linux

WORKDIR /home/openseespy-pip
# copy mac version
# COPY opensees.so /home/openseespy/openseespy-pip/openseespy/opensees/mac

WORKDIR /home/openseespy/openseespy-pip
RUN python3.8 build_pip.py build \
../opensees/SRC/interpreter/opensees.so \
../../opensees/SRC/interpreter/opensees.so \
copy_dep \
python3.8 no_zip

# upload pip to test
RUN python3.8 build_pip.py upload-test \
python3.8
########################################################

Expand Down
42 changes: 14 additions & 28 deletions openseespy-docker/build_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,9 @@ def build_docker(push=False):
# change to script's folder
os.chdir(os.path.dirname(os.path.abspath(__file__)))

# openseespy-pip
if os.path.exists('openseespy-pip'):
print('removing openseespy-pip')
shutil.rmtree('openseespy-pip')

shutil.copytree('../openseespy-pip', 'openseespy-pip')

# opensees
if os.path.exists('opensees'):
print('removing opensees')
shutil.rmtree('opensees')

shutil.copytree('../opensees', 'opensees')

# version
about = {}
with open('openseespy-pip/openseespy/version.py') as fp:
with open('../openseespy-pip/openseespy/version.py') as fp:
exec(fp.read(), about)
version = about['version']

Expand All @@ -40,24 +26,24 @@ def build_docker(push=False):
subprocess.run(['docker',
'build', '--target', 'ubuntu-pip',
'-t', f'ubuntu-pip:{version}', '.'])
subprocess.run(['docker',
'build', '--target', 'ubuntu-install',
'-t', f'zhuminjie/openseespy:{version}', '.'])
subprocess.run(['docker',
'build', '--target', 'ubuntu-notebook',
'-t', f'zhuminjie/openseespy:{version}-notebook', '.'])
# subprocess.run(['docker',
# 'build', '--target', 'ubuntu-install',
# '-t', f'zhuminjie/openseespy:{version}', '.'])
# subprocess.run(['docker',
# 'build', '--target', 'ubuntu-notebook',
# '-t', f'zhuminjie/openseespy:{version}-notebook', '.'])

if push:
subprocess.run(['docker', 'login'])
subprocess.run(['docker', 'image',
'push', tag_openseespy])
subprocess.run(['docker', 'image',
'push', tag_notebook])
# if push:
# subprocess.run(['docker', 'login'])
# subprocess.run(['docker', 'image',
# 'push', tag_openseespy])
# subprocess.run(['docker', 'image',
# 'push', tag_notebook])


if __name__ == "__main__":
push = False
for i in range(1, len(sys.argv)):
if sys.argv[i] == '-push':
if sys.argv[i] == 'push':
push = True
build_docker(push)
7 changes: 1 addition & 6 deletions openseespy-pip/build_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ def copy_mac_library(so):

def build_pip(pyexe='python', use_zip=False):

print('==============================================================')
print('Did you remember to update version number in opensees source?')
print('\n\n\n\n\n')
print('==============================================================')

# clean folders
subprocess.run(['rm', '-fr', 'build', 'dist', 'openseespy.egg-info'])

Expand Down Expand Up @@ -127,7 +122,7 @@ def install_pip(pyexe='python'):

if sys.argv[1] == 'build':
if len(sys.argv) < 6:
print('buld_pip build so copy_dep/no_copy pyexe use_zip')
print('buld_pip build so copy_dep/no_copy pyexe use_zip/no_zip')
exit()

so = sys.argv[2]
Expand Down
5 changes: 0 additions & 5 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ def update_version(version):
subprocess.run(['git', 'commit', '-m',
f'update version {version}'])

# update docker image
subprocess.run(['python3.8',
'openseespy-docker/build_docker.py'])

# push to github
subprocess.run(['git', 'push'])


if __name__ == '__main__':

if len(sys.argv) < 2:
Expand Down

0 comments on commit 68f1b24

Please sign in to comment.