Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
jfouret committed May 16, 2024
0 parents commit 88f402b
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
tags: [ '*' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: nexomis/kat

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

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

- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
prefix=
suffix=
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: |
org.opencontainers.image.created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
org.opencontainers.image.revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
org.opencontainers.image.source=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.source'] }}
org.opencontainers.image.url=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.url'] }}
org.opencontainers.image.version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
76 changes: 76 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Stage 1: Build environment
FROM ubuntu:20.04 as builder

ENV DEBIAN_FRONTEND=noninteractive

# Install build dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
autoconf \
automake \
make \
gcc \
g++ \
libc6-dev \
libtool \
python3-dev \
zlib1g-dev \
wget \
python3-numpy \
python3-scipy \
python3-matplotlib \
python3-sphinx \
python3-distutils \
python3-setuptools \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /opt/kat \
&& chmod o+rx /opt /opt/kat

# Clone KAT repository
WORKDIR /build
RUN wget https://github.com/TGAC/KAT/archive/refs/tags/Release-2.4.1.tar.gz \
&& tar xvzf Release-2.4.1.tar.gz

# Build KAT
WORKDIR /build/KAT-Release-2.4.1
RUN ./build_boost.sh
RUN ./autogen.sh
RUN ./configure --prefix /opt/kat
RUN make
RUN make install

# Stage 2: Runtime environment
FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

# Install runtime dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
zlib1g \
python3 \
libpython3.8 \
libtool \
libc6 \
python3-numpy \
python3-scipy \
python3-matplotlib \
python3-sphinx \
python3-distutils \
python3-setuptools \
python3-tabulate \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /opt/kat \
&& chmod o+rx /opt /opt/kat

# Copy the built KAT binaries from the builder stage
COPY --from=builder /opt/kat/bin /opt/kat/bin
COPY --from=builder /opt/kat/lib /opt/kat/lib

RUN ln -s /opt/kat/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages

# Set the environment variable to find shared libraries
ENV LD_LIBRARY_PATH=/opt/kat/lib:$LD_LIBRARY_PATH
ENV PATH=/opt/kat/bin:$PATH

# Define the default command to run KAT
ENTRYPOINT ["/opt/kat/bin/kat"]

0 comments on commit 88f402b

Please sign in to comment.