-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from Xiangyu-Hu/feature/docker
Feature/docker
- Loading branch information
Showing
7 changed files
with
175 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG build_with_dependencies_source=0 | ||
ARG sph_only_static_build=0 | ||
|
||
ENV TZ=Europe/Berlin | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
apt-utils \ | ||
build-essential \ | ||
cmake \ | ||
libtbb-dev \ | ||
libboost-all-dev \ | ||
libsimbody-dev \ | ||
libsimbody3.6 \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV TBB_HOME=/usr/lib/x86_64-linux-gnu | ||
ENV BOOST_HOME=/usr/lib/x86_64-linux-gnu | ||
ENV SIMBODY_HOME=/usr | ||
|
||
COPY ./ /home/SPHinXsys/ | ||
WORKDIR /home/SPHinXsys | ||
RUN rm -rf build | ||
RUN mkdir build && cd build && cmake .. -DBUILD_WITH_DEPENDENCIES_SOURCE=${build_with_dependencies_source} -DSPH_ONLY_STATIC_BUILD=${sph_only_static_build} && make -j$(nproc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ARG build_with_dependencies_source=0 | ||
ARG sph_only_static_build=0 | ||
ARG was_build=0 | ||
ARG build_with_visualization=off | ||
|
||
ENV TZ=Europe/Berlin | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
apt-utils \ | ||
build-essential \ | ||
cmake \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN if [ "$build_with_visualization" = on ] ; then cd /home \ | ||
&& apt-get update && apt-get install -y \ | ||
libglu1-mesa-dev freeglut3-dev mesa-common-dev libxi-dev libxmu-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/*; fi | ||
|
||
RUN if [ "$build_with_dependencies_source" = 0 ] ; then cd /home \ | ||
&& apt-get update && apt-get install -y \ | ||
libtbb-dev \ | ||
libboost-all-dev \ | ||
liblapack-dev \ | ||
wget \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& wget https://github.com/simbody/simbody/archive/Simbody-3.7.tar.gz \ | ||
&& tar xvzf Simbody-3.7.tar.gz \ | ||
&& rm Simbody-3.7.tar.gz \ | ||
&& mkdir /home/simbody-build && mkdir /home/simbody \ | ||
&& cd /home/simbody-build \ | ||
&& cmake /home/simbody-Simbody-3.7 -DCMAKE_INSTALL_PREFIX=/home/simbody -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_VISUALIZER=${build_with_visualization} -DBUILD_STATIC_LIBRARIES=on \ | ||
&& make -j$(nproc) \ | ||
# && ctest -j$(nproc) \ | ||
&& make -j$(nproc) install; fi | ||
|
||
ENV TBB_HOME=/usr/lib/x86_64-linux-gnu | ||
ENV BOOST_HOME=/usr/lib/x86_64-linux-gnu | ||
ENV SIMBODY_HOME=/home/simbody | ||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SIMBODY_HOME/lib | ||
ENV CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$SIMBODY_HOME/include | ||
|
||
COPY ./ /home/SPHinXsys/ | ||
WORKDIR /home/SPHinXsys | ||
RUN rm -rf build | ||
RUN mkdir build && cd build && cmake .. -DWASM_BUILD=${was_build} -DBUILD_WITH_DEPENDENCIES_SOURCE=${build_with_dependencies_source} -DSPH_ONLY_STATIC_BUILD=${sph_only_static_build} && make -j$(nproc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. | ||
on: pull_request | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
|
||
- name: Check Out Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: false | ||
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/sphinxsys:production | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cd build | ||
ctest |