diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 000000000..af6e219fe --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -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 }} \ No newline at end of file diff --git a/docker/Dockerfile.publish b/docker/Dockerfile.publish new file mode 100644 index 000000000..1edf539f0 --- /dev/null +++ b/docker/Dockerfile.publish @@ -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 \ No newline at end of file