Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

292 add a docker image publish #294

Merged
merged 13 commits into from
Oct 10, 2023
50 changes: 50 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Create and publish a Docker image

on:
push:
branches: ['release']
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
file: docker/Dockerfile.publish
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
27 changes: 27 additions & 0 deletions docker/Dockerfile.publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM fedora:37

RUN dnf -y update \
&& dnf -y install \
cmake \
gcc-c++ \
gdb \
git \
make \
zlib-devel \
llvm-devel \
&& dnf clean all

# copy the MICM code
COPY . /micm/

# build the library and run the tests
RUN mkdir /build \
&& cd /build \
&& cmake \
-D CMAKE_BUILD_TYPE=release \
-D ENABLE_LLVM:BOOL=TRUE \
-D ENABLE_JSON:BOOL=TRUE \
../micm \
&& make install -j 8

WORKDIR /build