Skip to content

Commit

Permalink
Add docker images for easier compilation and evaluation
Browse files Browse the repository at this point in the history
Create a number of Docker spec files that allow users to develop, test
and evaluate pfs on a range of Linux distros with minimal fuss.
  • Loading branch information
dtrugman committed Sep 30, 2022
1 parent b263c5c commit 8a7245a
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docker/Dockerfile-redhat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM redhat/ubi8:latest

WORKDIR /pfs

RUN yum update && \
yum install -y cmake gcc-c++

ENV CXX=g++
ENV CC=gcc

CMD /bin/bash
11 changes: 11 additions & 0 deletions docker/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM ubuntu:jammy

WORKDIR /pfs

RUN apt-get update && \
apt-get install -y cmake g++ build-essential

ENV CXX=g++
ENV CC=gcc

CMD /bin/bash
68 changes: 68 additions & 0 deletions docker/docker-pfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

lowercase() {
echo "$1" | tr '[:upper:]' '[:lower:]'
}

usage() {
echo "$0 [build|run] platform"
echo ""
echo "Build and/or run a docker image that can build pfs."
echo "There is a Dockerfile for each supported platform family."
echo ""
echo " build build docker image for specified platform"
echo " will be tagged as pfs:<platform>"
echo ""
echo " run run an already built image for a specified platform"
echo ""

return 2
}

build() {
declare -r platform="$(lowercase "$1")"

declare -r tag="$project:$platform"

declare -r file="Dockerfile-$platform"
if [[ ! -f "$file" ]]; then
echo "Platform probably not supported, cannot find $file"
return 1
fi

docker build \
--tag "$tag" \
--file "$file" \
"$root"
}

run() {
declare -r platform="$(lowercase "$1")"

declare -r tag="$project:$platform"

docker run --rm --interactive --tty \
--volume "$root:/$project" \
"$tag"
}

main() {
if [[ $# -ne 2 ]]; then
usage
return $?
fi

declare -r action="$1"
declare -r platform="$2"

declare -r project="pfs"
declare -r root="$(git rev-parse --show-toplevel)"

case "$action" in
build) build "$platform";;
run) run "$platform";;
*) usage; return $?;;
esac
}

main "$@"

0 comments on commit 8a7245a

Please sign in to comment.