Skip to content

Commit

Permalink
Deploying docker
Browse files Browse the repository at this point in the history
  • Loading branch information
ifilot committed Apr 23, 2024
1 parent 2df5413 commit 621184b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 13 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build-ubuntu-22-04:

runs-on: ubuntu-22.04

steps:
Expand Down Expand Up @@ -37,9 +36,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/coverage.xml


build-ubuntu-20-04:

runs-on: ubuntu-20.04

steps:
Expand All @@ -54,7 +51,6 @@ jobs:
run: cd build && make test

build-ubuntu-23-04:

runs-on: ubuntu-latest
container: ubuntu:23.04

Expand All @@ -70,7 +66,6 @@ jobs:
run: cd build && make test

build-ubuntu-23-10:

runs-on: ubuntu-latest
container: ubuntu:23.10

Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: docs

on:
push:
branches: [ "master", "develop" ]
pull_request:
branches: [ "master", "develop" ]

jobs:
deploy:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

needs: build-docs
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/ifilot/bramble
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Grab short SHA
shell: bash
run: |
echo "SHORT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
- name: Build and push Docker images
uses: docker/build-push-action@v4
with:
context: .
file: docker/deploy.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_HASH: ${{ env.SHORT_SHA }}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: doc.Dockerfile
file: docker/doc.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
15 changes: 15 additions & 0 deletions docker/deploy.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04
ARG GIT_HASH

# install dependencies
RUN apt update
RUN apt install -y build-essential cmake libeigen3-dev libtclap-dev libboost-all-dev nano

# install Bramble
ADD src /tmp/src
ADD patterns /tmp/patterns
RUN mkdir /tmp/build
WORKDIR /tmp/build
RUN cmake ../src -DMOD_CUDA=1
RUN make -j
RUN make install
File renamed without changes.
20 changes: 13 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ if(USE_GCOV)
endif()

# store git hash
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(DEFINED ENV{GIT_HASH})
set(GIT_HASH $ENV{GIT_HASH})
MESSAGE(STATUS "GIT HASH externally defined: " ${GIT_HASH})
else()
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "GIT HASH grabbed from Git command: " GIT_HASH)
endif()

# prepare configuration file
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "1")
SET(VERSION_PATCH "2")
SET(VERSION_PATCH "3")
message(STATUS "Writing configuration file in: ${CMAKE_CURRENT_SOURCE_DIR}/config.h")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h @ONLY)

Expand Down

0 comments on commit 621184b

Please sign in to comment.