Skip to content

Commit

Permalink
Merge pull request #4 from RECETOX/add_dockerfile
Browse files Browse the repository at this point in the history
Updated Dockerfile, build script, added GitHub workflow
  • Loading branch information
hechth authored Feb 15, 2024
2 parents f83be32 + eca457e commit dbbad00
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image Build CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag recetox/qcxms-docker:main
26 changes: 26 additions & 0 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: push Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: recetox/qcxms-docker:${{ github.event.release.tag_name }}
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
FROM ubuntu:20.04
RUN sudo apt-get install git
RUN git clone https://github.com/qcxms/qcxms
RUN git checkout ...
COPY build.sh .
RUN bash build.sh
...

# Update package lists
RUN apt-get update -y

# Install wget and xz-utils
RUN apt-get install -y wget xz-utils python3

# Create directories for extraction
RUN mkdir /qcxms_bin
RUN mkdir /plotms_bin

# Download and extract QCxMS and PlotMS
RUN wget https://github.com/qcxms/QCxMS/releases/download/v.5.2.1/QCxMS.v.5.2.1.tar.xz && tar -xvf QCxMS.v.5.2.1.tar.xz -C /qcxms_bin
RUN wget https://github.com/qcxms/PlotMS/releases/download/v.6.2.0/PlotMS.v.6.2.0.tar.xz && tar -xvf PlotMS.v.6.2.0.tar.xz -C /plotms_bin

RUN chmod +x /qcxms_bin/getres
41 changes: 41 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update
apt-get install -y gcc-9 gfortran-9

update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-9 100 \
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-9 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-9


mkdir -p /opt/intel
chown $USER:$USER /opt/intel

wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB

apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB

echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list

apt-get update
apt-get install -y intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic intel-oneapi-mkl intel-oneapi-mkl-devel

source /opt/intel/oneapi/setvars.sh
source /opt/intel/oneapi/compiler/2024.0/env/vars.sh

pip install meson==0.58.0 ninja

set -ex
export FC=ifort CC=icc

meson setup _build \
${MESON_ARGS:---prefix=$PWD/qcxms_bin --libdir=lib} \
--buildtype=release \
-Dfortran_link_args=-qopenmp

meson compile -C _build

meson install -C _build --no-rebuild

0 comments on commit dbbad00

Please sign in to comment.