Skip to content

Commit

Permalink
Support automatic docker build of analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Anil Panta authored and hansenjo committed Nov 17, 2023
1 parent 8fe67c4 commit 170e466
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Image CI

on:
push:
tags: ['**']

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: jeffersonlab/analyzer
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Build and push
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}"
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
DOCKER_TAG=${{ steps.meta.outputs.tags }}
APP_VERSION=${{ github.ref_name}}
REPO_NAME=${{ github.event.repository.name }}
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM centos:centos7

ARG APP_VERSION
ARG REPO_NAME

RUN yum update -q -y

RUN yum -y install epel-release &&\
yum -y install git && \
yum -y groupinstall 'Development Tools'&& \
yum -y install gcc-c++ && \
yum -y install make && \
yum install -y root && \
yum install -y which && \
yum install -y root-montecarlo-eg && \
localedef -i en_US -f UTF-8 en_US.UTF-8

ADD https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2-linux-x86_64.tar.gz .
RUN tar -xvf cmake-3.22.2-linux-x86_64.tar.gz && rm cmake-3.22.2-linux-x86_64.tar.gz
RUN mv cmake-3.22.2-linux-x86_64 /usr/local/cmake
ENV PATH="/usr/local/cmake/bin:$PATH"
ADD https://github.com/JeffersonLab/${REPO_NAME}/archive/refs/tags/${APP_VERSION}.tar.gz .
RUN tar -xvf ${APP_VERSION}.tar.gz && rm ${APP_VERSION}.tar.gz
WORKDIR "/${REPO_NAME}-${APP_VERSION}"
RUN cmake -DCMAKE_INSTALL_PREFIX=/usr/local/analyzer -B BUILD -S /${REPO_NAME}-${APP_VERSION}/
RUN cmake --build BUILD -j8
RUN cmake --install BUILD
ENV LD_LIBRARY_PATH="/usr/local/analyzer/lib64:$LD_LIBRARY_PATH"
ENV ANALYZER="/usr/local/analyzer"
ENV PATH="/usr/local/analyzer/bin:/usr/bin/root:$PATH"
ENV ROOTSYS="/usr/"

0 comments on commit 170e466

Please sign in to comment.