Skip to content

Commit

Permalink
Update icon docker image build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jspark-icon committed Sep 1, 2021
1 parent f4c6341 commit 59d4625
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 56 deletions.
18 changes: 8 additions & 10 deletions docker/gochain-icon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
ARG IMAGE_PY_DEPS
FROM ${IMAGE_PY_DEPS}
ARG IMAGE_BASE
FROM ${IMAGE_BASE}
LABEL MAINTAINER="[email protected]"

# install JRE
RUN apk add --no-cache openjdk11-jre-headless

ARG GOCHAIN_ICON_VERSION
LABEL GOCHAIN_ICON_VERSION="$GOCHAIN_ICON_VERSION"

# install python executor
ADD dist/iconee-*.whl /goloop/
RUN /entrypoint python3 -m pip -q install /goloop/iconee-*.whl && \
rm -f /goloop/iconee-*.whl
ADD dist/pyee /goloop/pyee
RUN /entrypoint python3 -m pip -q install /goloop/pyee/iconee-*.whl && \
rm -rf /goloop/pyee

# install java executor
ARG JAVAEE_VERSION
ADD dist/execman-${JAVAEE_VERSION}.zip /goloop/
RUN unzip -q /goloop/execman-${JAVAEE_VERSION}.zip -d /goloop/ && \
mv /goloop/execman-${JAVAEE_VERSION} /goloop/execman && \
rm -f /goloop/execman-*.zip
ENV JAVAEE_BIN /goloop/execman/bin/execman

# install gochain and other stuff
ADD dist/gochain /goloop/bin/
ADD dist/bin/* /goloop/bin/
ENV PATH $PATH:/goloop/bin
WORKDIR /goloop

# container configuration
WORKDIR /goloop
EXPOSE 9080/tcp
EXPOSE 8080/tcp

Expand Down
3 changes: 2 additions & 1 deletion docker/gochain-icon/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ PRE_PWD=$(pwd)
WORKDIR=$(dirname "$(readlink -f ${0})")
cd $WORKDIR

export IMAGE_BASE=${IMAGE_BASE:-goloop/base-all:latest}

export GOCHAIN_ICON_VERSION=${GOCHAIN_ICON_VERSION:-$(git describe --always --tags --dirty)}
export IMAGE_PY_DEPS=${IMAGE_PY_DEPS:-goloop/py-deps:latest}
IMAGE_GOCHAIN_ICON=${IMAGE_GOCHAIN_ICON:-goloop/gochain-icon:latest}

./update.sh "${IMAGE_GOCHAIN_ICON}" ../..
Expand Down
9 changes: 8 additions & 1 deletion docker/gochain-icon/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
# Path to configuration file. If it doesn't exist, it will
# automatically generate one.
#
# GOCHAIN_DB_TYPE (default:"goleveldb")
# Name of database system.
#
# GOCHAIN_GENESIS (optional)
# Path to the genesis transaction or template file.
# It will override configuration file.
Expand Down Expand Up @@ -59,6 +62,7 @@ GOCHAIN="gochain"
GOCHAIN_DATA=${GOCHAIN_DATA:-"./data"}
GOCHAIN_CONFIG=${GOCHAIN_CONFIG:-"./config.json"}
GOCHAIN_KEYSTORE=${GOCHAIN_KEYSTORE:-"./keystore.json"}
GOCHAIN_DB_TYPE=${GOCHAIN_DB_TYPE:-"goleveldb"}

if [ ${GOCHAIN_CLEAN_DATA} == "true" ] ; then
rm -rf ${GOCHAIN_DATA} || exit 1
Expand All @@ -72,10 +76,13 @@ fi

GOCHAIN_OPTIONS="--chain_dir ${GOCHAIN_DATA}"
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --ee_socket /tmp/socket"
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --db_type goleveldb"
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --role 3"
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --platform icon"

if [ "${GOCHAIN_DB_TYPE}" != "" ] ; then
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --db_type ${GOCHAIN_DB_TYPE}"
fi

if [ "${GOCHAIN_GENESIS}" != "" ] ; then
GOCHAIN_OPTIONS="$GOCHAIN_OPTIONS --genesis ${GOCHAIN_GENESIS}"
fi
Expand Down
14 changes: 7 additions & 7 deletions docker/gochain-icon/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ build_image() {
JAVAEE_VERSION=$(grep "^VERSION=" ${SRC_DIR}/javaee/gradle.properties | cut -d= -f2)
BIN_DIR=${BIN_DIR:-${SRC_DIR}/bin}
if [ "${GOBUILD_TAGS}" != "" ] ; then
GOCHAIN_ICON_VERSION="${GOCHAIN_ICON_VERSION}-tags(${GOBUILD_TAGS})"
GOCHAIN_ICON_VERSION="${GOCHAIN_ICON_VERSION}-tags(${GOBUILD_TAGS})"
fi

# copy required files to ${BUILD_DIR}/dist
rm -rf ${BUILD_DIR}/dist
mkdir -p ${BUILD_DIR}/dist
cp ${BIN_DIR}/gochain ${BUILD_DIR}/dist/
cp ${SRC_DIR}/build/iconee/dist/iconee-*.whl ${BUILD_DIR}/dist/
mkdir -p ${BUILD_DIR}/dist/bin
cp ${BIN_DIR}/gochain ${BUILD_DIR}/dist/bin/

mkdir -p ${BUILD_DIR}/dist/pyee
cp ${SRC_DIR}/build/iconee/dist/iconee-*.whl ${BUILD_DIR}/dist/pyee/
cp ${SRC_DIR}/javaee/app/execman/build/distributions/execman-${JAVAEE_VERSION}.zip ${BUILD_DIR}/dist/

CDIR=$(pwd)
cd ${BUILD_DIR}

echo "Building image ${TAG}"
docker build \
--build-arg IMAGE_PY_DEPS="${IMAGE_PY_DEPS}" \
--build-arg IMAGE_BASE="${IMAGE_BASE}" \
--build-arg GOCHAIN_ICON_VERSION="${GOCHAIN_ICON_VERSION}" \
--build-arg JAVAEE_VERSION="${JAVAEE_VERSION}" \
--tag ${TAG} .
local result=$?

cd ${CDIR}

# rm -rf ${BUILD_DIR}/dist

return $result
}

Expand Down
11 changes: 5 additions & 6 deletions docker/goloop-icon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ARG IMAGE_PY_DEPS
FROM ${IMAGE_PY_DEPS}
ARG IMAGE_BASE
FROM ${IMAGE_BASE}
LABEL MAINTAINER="[email protected]"

# install JRE
RUN apk add --no-cache openjdk11-jre-headless

ARG GOLOOP_ICON_VERSION
LABEL GOLOOP_ICON_VERSION="$GOLOOP_ICON_VERSION"

Expand All @@ -24,10 +21,12 @@ ENV JAVAEE_BIN /goloop/execman/bin/execman
# install goloop and other stuff
ADD dist/bin/* /goloop/bin/
ENV PATH $PATH:/goloop/bin

# install genesis governance
ADD icon_governance.zip /goloop/
WORKDIR /goloop

# container configuration
WORKDIR /goloop
EXPOSE 9080/tcp
EXPOSE 8080/tcp
VOLUME ["/goloop/data"]
Expand Down
3 changes: 2 additions & 1 deletion docker/goloop-icon/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ PRE_PWD=$(pwd)
WORKDIR=$(dirname "$(readlink -f ${0})")
cd $WORKDIR

export IMAGE_BASE=${IMAGE_BASE:-goloop/base-all:latest}

export GOLOOP_ICON_VERSION=${GOLOOP_ICON_VERSION:-$(git describe --always --tags --dirty)}
export IMAGE_PY_DEPS=${IMAGE_PY_DEPS:-goloop/py-deps:latest}
IMAGE_GOLOOP_ICON=${IMAGE_GOLOOP_ICON:-goloop-icon:latest}

./update.sh "${IMAGE_GOLOOP_ICON}" ../..
Expand Down
5 changes: 3 additions & 2 deletions docker/goloop-icon/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,21 @@ build_image() {

# copy required files to ${BUILD_DIR}/dist
rm -rf ${BUILD_DIR}/dist
mkdir -p ${BUILD_DIR}/dist/bin/
mkdir -p ${BUILD_DIR}/dist/bin
cp ${BIN_DIR}/goloop ${BUILD_DIR}/dist/bin/
cp -f ${BIN_DIR}/gstool ${BUILD_DIR}/dist/bin/

mkdir -p ${BUILD_DIR}/dist/pyee
cp ${SRC_DIR}/build/iconee/dist/iconee-*.whl ${BUILD_DIR}/dist/pyee/

cp ${SRC_DIR}/javaee/app/execman/build/distributions/execman-${JAVAEE_VERSION}.zip ${BUILD_DIR}/dist/

CDIR=$(pwd)
cd ${BUILD_DIR}

echo "Building image ${TAG}"
docker build \
--build-arg IMAGE_PY_DEPS="${IMAGE_PY_DEPS}" \
--build-arg IMAGE_BASE="${IMAGE_BASE}" \
--build-arg GOLOOP_ICON_VERSION="${GOLOOP_ICON_VERSION}" \
--build-arg JAVAEE_VERSION="${JAVAEE_VERSION}" \
--tag ${TAG} .
Expand Down
24 changes: 12 additions & 12 deletions docker/lcimport/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
ARG IMAGE_PY_DEPS
FROM ${IMAGE_PY_DEPS}
ARG IMAGE_BASE
FROM ${IMAGE_BASE}
LABEL MAINTAINER="[email protected]"

# install JRE
RUN apk add --no-cache openjdk11-jre-headless

ARG LCIMPORT_VERSION
LABEL LCIMPORT_VERSION="$LCIMPORT_VERSION"

# install python executor
ADD dist/iconee-*.whl /goloop/
RUN /entrypoint python3 -m pip -q install /goloop/iconee-*.whl && \
rm -f /goloop/iconee-*.whl
ADD dist/pyee /goloop/pyee
RUN /entrypoint python3 -m pip -q install /goloop/pyee/iconee-*.whl && \
rm -rf /goloop/pyee

# install java executor
#ARG JAVAEE_VERSION
#ADD dist/execman-${JAVAEE_VERSION}.zip /goloop/
#RUN unzip -q /goloop/execman-${JAVAEE_VERSION}.zip -d /goloop/ && \
# mv /goloop/execman-${JAVAEE_VERSION} /goloop/execman && \
# rm -f /goloop/execman-*.zip
#ENV JAVAEE_BIN /goloop/execman/bin/execman

# install gochain and other stuff
ADD dist/lcimport /goloop/bin/
# install lcimport and other stuff
ADD dist/bin/* /goloop/bin/
ENV PATH $PATH:/goloop/bin
WORKDIR /goloop

# install genesis governance
ADD icon_governance.zip /goloop/

# container configuration
WORKDIR /goloop
VOLUME [ "/goloop/data" ]

ENV LCIMPORT_DATA="/goloop/data"

ENV PYEE_VERIFY_PACKAGE="true"
CMD [ "/goloop/bin/lcimport", "executor", "run" ]
CMD [ "/goloop/bin/lcimport", "executor", "run" ]
3 changes: 2 additions & 1 deletion docker/lcimport/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ PRE_PWD=$(pwd)
WORKDIR=$(dirname "$(readlink -f ${0})")
cd $WORKDIR

export IMAGE_BASE=${IMAGE_BASE:-goloop/base-py:latest}

export LCIMPORT_VERSION=${LCIMPORT_VERSION:-$(git describe --always --tags --dirty)}
export IMAGE_PY_DEPS=${IMAGE_PY_DEPS:-goloop/py-deps:latest}
IMAGE_LCIMPORT=${IMAGE_LCIMPORT:-goloop/lcimport:latest}

./update.sh "${IMAGE_LCIMPORT}" ../..
Expand Down
18 changes: 9 additions & 9 deletions docker/lcimport/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ build_image() {
JAVAEE_VERSION=$(grep "^VERSION=" ${SRC_DIR}/javaee/gradle.properties | cut -d= -f2)
BIN_DIR=${BIN_DIR:-${SRC_DIR}/bin}
if [ "${GOBUILD_TAGS}" != "" ] ; then
LCIMPORT_VERSION="${LCIMPORT_VERSION}-tags(${GOBUILD_TAGS})"
LCIMPORT_VERSION="${LCIMPORT_VERSION}-tags(${GOBUILD_TAGS})"
fi

# copy required files to ${BUILD_DIR}/dist
rm -rf ${BUILD_DIR}/dist
mkdir -p ${BUILD_DIR}/dist
cp ${BIN_DIR}/lcimport ${BUILD_DIR}/dist/
cp ${SRC_DIR}/build/iconee/dist/iconee-*.whl ${BUILD_DIR}/dist/
mkdir -p ${BUILD_DIR}/dist/bin
cp ${BIN_DIR}/lcimport ${BUILD_DIR}/dist/bin/

mkdir -p ${BUILD_DIR}/dist/pyee
cp ${SRC_DIR}/build/iconee/dist/iconee-*.whl ${BUILD_DIR}/dist/pyee/
# cp ${SRC_DIR}/javaee/app/execman/build/distributions/execman-${JAVAEE_VERSION}.zip ${BUILD_DIR}/dist/

CDIR=$(pwd)
cd ${BUILD_DIR}

echo "Building image ${TAG}"
docker build \
--build-arg IMAGE_PY_DEPS="${IMAGE_PY_DEPS}" \
--build-arg LCIMPORT_VERSION="${LCIMPORT_VERSION}" \
--build-arg IMAGE_BASE="${IMAGE_BASE}" \
--build-arg JAVAEE_VERSION="${JAVAEE_VERSION}" \
--build-arg LCIMPORT_VERSION="${LCIMPORT_VERSION}" \
--tag ${TAG} .
local result=$?

cd ${CDIR}

# rm -rf ${BUILD_DIR}/dist

rm -rf ${BUILD_DIR}/dist
return $result
}

Expand Down
12 changes: 6 additions & 6 deletions icon/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ iconexec:
python3 setup.py bdist_wheel -d $(ICONEE_DIST_DIR) ; \
rm -rf iconee.egg-info

lcimport-image: pyrun-iconexec gorun-lcimport-linux
lcimport-image: base-image-py pyrun-iconexec gorun-lcimport-linux
@ echo "[#] Building lcimport for $(GL_VERSION)"
@ \
rm -rf $(LCIMPORT_DOCKER_DIR); \
BIN_DIR=$(abspath $(LINUX_BIN_DIR)) \
IMAGE_PY_DEPS=$(PYDEPS_IMAGE) \
IMAGE_BASE=$(BASE_PY_IMAGE) \
LCIMPORT_VERSION=$(GL_VERSION) \
GOBUILD_TAGS="$(GOBUILD_TAGS)" \
$(BUILD_ROOT)/docker/lcimport/update.sh $(LCIMPORT_IMAGE) $(BUILD_ROOT) $(LCIMPORT_DOCKER_DIR)

gochain-icon-image: pyrun-iconexec gorun-gochain-linux javarun-javaexec
gochain-icon-image: base-image-all pyrun-iconexec gorun-gochain-linux javarun-javaexec
@ echo "[#] Building image $(GOCHAIN_ICON_IMAGE) for $(GL_VERSION)"
@ \
rm -rf $(GOCHAIN_ICON_DOCKER_DIR); \
BIN_DIR=$(abspath $(LINUX_BIN_DIR)) \
IMAGE_PY_DEPS=$(PYDEPS_IMAGE) \
IMAGE_BASE=$(BASE_IMAGE) \
GOCHAIN_ICON_VERSION=$(GL_VERSION) \
GOBUILD_TAGS="$(GOBUILD_TAGS)" \
$(BUILD_ROOT)/docker/gochain-icon/update.sh $(GOCHAIN_ICON_IMAGE) $(BUILD_ROOT) $(GOCHAIN_ICON_DOCKER_DIR)

goloop-icon-image: pyrun-iconexec gorun-goloop-linux javarun-javaexec
goloop-icon-image: base-image-all pyrun-iconexec gorun-goloop-linux javarun-javaexec
@ echo "[#] Building image $(GOLOOP_ICON_IMAGE) for $(GL_VERSION)"
@ \
rm -rf $(GOLOOP_ICON_DOCKER_DIR); \
BIN_DIR=$(abspath $(LINUX_BIN_DIR)) \
IMAGE_PY_DEPS=$(PYDEPS_IMAGE) \
IMAGE_BASE=$(BASE_IMAGE) \
GOLOOP_ICON_VERSION=$(GL_VERSION) \
GOBUILD_TAGS="$(GOBUILD_TAGS)" \
$(BUILD_ROOT)/docker/goloop-icon/update.sh $(GOLOOP_ICON_IMAGE) $(BUILD_ROOT) $(GOLOOP_ICON_DOCKER_DIR)

0 comments on commit 59d4625

Please sign in to comment.