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

feat(build): add support for building on arm and x86 #294

Merged
merged 3 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@
set -e

pwd

# Determine the arch/os we're building for
ARCH=$(uname -m)

make clean
bash autogen.sh
./configure --enable-replication
make clean
make

BUILD_DATE=$(date +'%Y%m%d%H%M%S')
REPO_NAME="openebs/cstor-istgt"
if [ "${ARCH}" = "x86_64" ]; then
REPO_NAME="openebs/cstor-istgt"
DOCKERFILE="Dockerfile"
elif [ "${ARCH}" = "aarch64" ]; then
REPO_NAME="openebs/cstor-istgt-arm64"
DOCKERFILE="Dockerfile.arm64"
else
echo "Unusable architecture: ${ARCH}"
exit 1
fi

echo "Build image ${REPO_NAME}:ci with BUILD_DATE=${BUILD_DATE}"

Expand All @@ -22,7 +35,7 @@ sudo docker version
sudo docker build --help

cd docker && \
sudo docker build -f Dockerfile -t ${REPO_NAME}:ci --build-arg BUILD_DATE=${BUILD_DATE} . && \
sudo docker build -f ${DOCKERFILE} -t ${REPO_NAME}:ci --build-arg BUILD_DATE=${BUILD_DATE} . && \
IMAGE_REPO=${REPO_NAME} ./push && \
cd ..

Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ COPY entrypoint-istgtimage.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint-istgtimage.sh

ARG BUILD_DATE
LABEL org.label-schema.name="cstor"
LABEL org.label-schema.description="OpenEBS cstor"
LABEL org.label-schema.name="istgt"
LABEL org.label-schema.description="OpenEBS istgt"
LABEL org.label-schema.url="http://www.openebs.io/"
LABEL org.label-schema.vcs-url="https://github.com/openebs/cstor"
LABEL org.label-schema.vcs-url="https://github.com/openebs/istgt"
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE

Expand Down
31 changes: 31 additions & 0 deletions docker/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# This Dockerfile builds cstor istgt container running istgt from istgt base image
#

FROM arm64v8/ubuntu:18.04
RUN apt-get update; exit 0
RUN apt-get -y install rsyslog
RUN apt-get -y install curl tcpdump dnsutils net-tools iputils-ping gdb
RUN apt-get -y install apt-utils libssl-dev libjson-c-dev libjemalloc-dev
RUN apt-get -y install apt-file && apt-file update

RUN mkdir -p /usr/local/etc/bkpistgt
RUN mkdir -p /usr/local/etc/istgt
COPY istgt istgtcontrol /usr/local/bin/
COPY istgt.conf istgtcontrol.conf /usr/local/etc/bkpistgt/
RUN touch /usr/local/etc/bkpistgt/auth.conf
RUN touch /usr/local/etc/bkpistgt/logfile

COPY entrypoint-istgtimage.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint-istgtimage.sh

ARG BUILD_DATE
LABEL org.label-schema.name="istgt"
LABEL org.label-schema.description="OpenEBS istgt"
LABEL org.label-schema.url="http://www.openebs.io/"
LABEL org.label-schema.vcs-url="https://github.com/openebs/istgt"
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.build-date=$BUILD_DATE

ENTRYPOINT entrypoint-istgtimage.sh
EXPOSE 3260 6060
3 changes: 2 additions & 1 deletion docker/entrypoint-istgtimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ touch /usr/local/etc/istgt/logfile
export externalIP=0.0.0.0
service rsyslog start

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so
ARCH=$(uname -m)
pawanpraka1 marked this conversation as resolved.
Show resolved Hide resolved
export LD_PRELOAD=/usr/lib/${ARCH}-linux-gnu/libjemalloc.so
exec /usr/local/bin/istgt