feat: adding dockerfile for docker image building (#56)
* feat: adding docker support * fix: typo in READMEpull/68/head
parent
7c5afec284
commit
5dc78909ce
|
|
@ -0,0 +1,27 @@
|
||||||
|
ARG platformName=ubuntu
|
||||||
|
ARG platformVersion=latest
|
||||||
|
FROM ${platformName}:${platformVersion}
|
||||||
|
|
||||||
|
ARG version
|
||||||
|
ARG configure
|
||||||
|
ARG build="--targets=*"
|
||||||
|
|
||||||
|
ENV NORM_DIR=/norm-staging
|
||||||
|
ENV NORM_BUILD=$NORM_DIR/build
|
||||||
|
ENV WAF_CONFIGURE=${configure}
|
||||||
|
ENV WAF_BUILD=${build}
|
||||||
|
|
||||||
|
ADD ./ ${NORM_DIR}
|
||||||
|
|
||||||
|
# Step 1: dependencies
|
||||||
|
RUN VERSION=${version} ${NORM_DIR}/docker/setup.sh
|
||||||
|
|
||||||
|
# Step 2: build
|
||||||
|
RUN cd ${NORM_DIR} && ./waf ${WAF_BUILD}
|
||||||
|
|
||||||
|
# Step 3: install
|
||||||
|
RUN cd ${NORM_DIR} && ./waf install
|
||||||
|
|
||||||
|
# Step 4: expose
|
||||||
|
COPY ./docker/run.sh /usr/bin/run-norm-example
|
||||||
|
ENTRYPOINT [ "run-norm-example" ]
|
||||||
33
README.md
33
README.md
|
|
@ -99,6 +99,37 @@ More info is available in the norp/doc directory, as well as the
|
||||||
NORP website: https://www.nrl.navy.mil/itd/ncs/products/norp
|
NORP website: https://www.nrl.navy.mil/itd/ncs/products/norp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Docker
|
||||||
|
======
|
||||||
|
A `Dockerfile` is provided to facilitate containerized NORM environment testing. Notable
|
||||||
|
build arguments passed to `docker build` will influence how the image is created.
|
||||||
|
|
||||||
|
- `platformName` represents the base image name (defaults to `ubuntu`)
|
||||||
|
- `platformVersion` represents the tagged version for the base image (defaults to `latest`)
|
||||||
|
- `version` is a 1:1 mapping to this repo's tag (defaults to `v1.5.9`)
|
||||||
|
- `configure` is piped to `./waf configure` (defaults to "")
|
||||||
|
- `build` is piped to `./waf` (defaults to `--targets=*`)
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
|
||||||
|
CentOS7 build
|
||||||
|
```
|
||||||
|
docker build --build-arg platformName=centos \
|
||||||
|
--build-arg platformVersion=7 \
|
||||||
|
--build-arg="--build-java" \
|
||||||
|
-t norm:centos-1.5.9 .
|
||||||
|
```
|
||||||
|
|
||||||
|
Running the data send and recv examples:
|
||||||
|
```
|
||||||
|
# Sender in one terminal
|
||||||
|
docker run -it --rm --name norm-send <norm:image> normDataSend
|
||||||
|
# Receiver in another terminal
|
||||||
|
docker run -it --rm --name norm-recv <norm:image> normDataRecv
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
OTHER FILES:
|
OTHER FILES:
|
||||||
============
|
============
|
||||||
|
|
||||||
|
|
@ -115,6 +146,8 @@ VERSION.TXT - NORM version history notes
|
||||||
|
|
||||||
README.md - this file
|
README.md - this file
|
||||||
|
|
||||||
|
docker - directory containing docker container support
|
||||||
|
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
======
|
======
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo Running example $@
|
||||||
|
|
||||||
|
exec "$NORM_BUILD/$@"
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
install_debian()
|
||||||
|
{
|
||||||
|
apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
|
||||||
|
python2.7 \
|
||||||
|
g++ \
|
||||||
|
libxml2-dev \
|
||||||
|
libnetfilter-queue-dev
|
||||||
|
|
||||||
|
ln -s /usr/bin/python2.7 /usr/bin/python
|
||||||
|
|
||||||
|
if [ "$VERSION" != "" ]; then
|
||||||
|
apt-get install -yq git-core
|
||||||
|
cd $NORM_DIR && git checkout $VERSION && git submodule update --checkout --init --force
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$WAF_CONFIGURE" =~ "java" && -z `which java` ]]; then
|
||||||
|
apt-get install -yq default-jdk-headless
|
||||||
|
export JAVA_HOME=$(readlink -f `which java` | sed 's/\/bin\/java//')
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_redhat()
|
||||||
|
{
|
||||||
|
yum update -y
|
||||||
|
yum install -y \
|
||||||
|
which \
|
||||||
|
centos-release-scl
|
||||||
|
yum install -y \
|
||||||
|
gcc-c++ \
|
||||||
|
libxml2-devel \
|
||||||
|
libnetfilter_queue-devel
|
||||||
|
|
||||||
|
if [ "$VERSION" != "" ]; then
|
||||||
|
yum install -y git
|
||||||
|
cd $NORM_DIR && git checkout $VERSION && git submodule update --checkout --init --force
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$WAF_CONFIGURE" =~ "java" && -z `which java` ]]; then
|
||||||
|
yum install -y java-1.8.0-openjdk-devel
|
||||||
|
export JAVA_HOME=$(readlink -f `which java` | sed 's/\/jre\/bin\/java//')
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_norm()
|
||||||
|
{
|
||||||
|
cd $NORM_DIR && ./waf configure ${WAF_CONFIGURE}
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -z `which apt` ]; then
|
||||||
|
install_debian
|
||||||
|
elif [ ! -z $(which yum) ] || [ "$?" = "1" ]; then
|
||||||
|
install_redhat
|
||||||
|
fi
|
||||||
|
configure_norm
|
||||||
Loading…
Reference in New Issue