Skip to content

Commit

Permalink
devtools only
Browse files Browse the repository at this point in the history
  • Loading branch information
RaymondMouthaan committed Aug 25, 2019
1 parent 8cd04e3 commit 6cf0fa6
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 275 deletions.
7 changes: 3 additions & 4 deletions .docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ RUN set -ex && \
# Install Python gpio library
RUN chmod u+x /tmp/install_python_gpio.sh && /tmp/install_python_gpio.sh

# Install Devtools
RUN chmod u+x /tmp/install_devtools.sh && /tmp/install_devtools.sh

# Set work directory
WORKDIR /usr/src/node-red

Expand All @@ -74,7 +71,9 @@ RUN chmod u+x /tmp/fix_python_gpio.sh && /tmp/fix_python_gpio.sh
RUN chmod u+x /tmp/rebuild_bcrypt.sh && /tmp/rebuild_bcrypt.sh

# Cleanup tmp
RUN rm -r /tmp/*
RUN set -ex && \
chmod u+x /tmp/uninstall_devtools.sh && /tmp/uninstall_devtools.sh && \
rm -r /tmp/*

# Return as node-red user
USER node-red
Expand Down
201 changes: 96 additions & 105 deletions .docker/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,44 +83,35 @@ docker_test() {
docker_tag() {
echo "DOCKER TAG: Tag Docker image."

if [ ${PYTHON_VERSION} == "0" ]; then
echo "DOCKER TAG: tagging image - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}."
docker tag ${TARGET}:build ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}
if [ ${TAG_SUFFIX} == "default" ]; then
echo "DOCKER TAG: tagging image - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}."
docker tag ${TARGET}:build ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}
else
if [ ${DEVTOOLS} == "1" ]; then
echo "DOCKER TAG: tagging image - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}-devtools."
docker tag ${TARGET}:build ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}-devtools
else
echo "DOCKER TAG: tagging image - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}."
docker tag ${TARGET}:build ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}
fi
echo "DOCKER TAG: tagging image - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}-${TAG_SUFFIX}"
docker tag ${TARGET}:build ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}-${TAG_SUFFIX}
fi

}

docker_push() {
echo "DOCKER PUSH: Push Docker image."

if [ ${PYTHON_VERSION} == "0" ]; then
echo "DOCKER PUSH: pushing - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}."
docker push ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}
if [ ${TAG_SUFFIX} == "default" ]; then
echo "DOCKER PUSH: pushing - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}."
docker push ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}
else
if [ ${DEVTOOLS} == "1" ]; then
echo "DOCKER PUSH: pushing - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}-devtools."
docker push ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}-devtools
else
echo "DOCKER PUSH: pushing - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}."
docker push ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${OS}-${ARCH}-python${PYTHON_VERSION}
fi
echo "DOCKER PUSH: pushing - ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}-${TAG_SUFFIX}."
docker push ${TARGET}:${BUILD_VERSION}-${NODE_VERSION}-${ARCH}-${TAG_SUFFIX}
fi
}

docker_manifest_list() {

# Create and push manifest lists
echo "DOCKER MANIFEST: Create and Push docker manifest lists."
docker_manifest_list_version_rpi_python2 ${1}
docker_manifest_list_version_rpi_python3 ${1}
docker_manifest_list_version_rpi ${1}
# docker_manifest_list_version_rpi_python2 ${1}
# docker_manifest_list_version_rpi_python3 ${1}
# docker_manifest_list_version_rpi ${1}
docker_manifest_list_version_python2 ${1}
docker_manifest_list_version_python3 ${1}
docker_manifest_list_version ${1}
Expand All @@ -129,37 +120,37 @@ docker_manifest_list() {
case ${BUILD_VERSION} in
*"testing"*)
echo "DOCKER MANIFEST: Create and Push docker manifest list TESTING Node JS."
docker_manifest_list_testing_or_latest_rpi_python2 ${1} "testing"
docker_manifest_list_testing_or_latest_rpi_python3 ${1} "testing"
docker_manifest_list_testing_or_latest_rpi ${1} "testing"
# docker_manifest_list_testing_or_latest_rpi_python2 ${1} "testing"
# docker_manifest_list_testing_or_latest_rpi_python3 ${1} "testing"
# docker_manifest_list_testing_or_latest_rpi ${1} "testing"
docker_manifest_list_testing_or_latest_python2 ${1} "testing"
docker_manifest_list_testing_or_latest_python3 ${1} "testing"
docker_manifest_list_testing_or_latest ${1} "testing"

if [[ ${1} == "-10" ]]; then
echo "DOCKER MANIFEST: Create and Push docker manifest list TESTING."
docker_manifest_list_testing_or_latest_rpi_python2 "" "testing"
docker_manifest_list_testing_or_latest_rpi_python3 "" "testing"
docker_manifest_list_testing_or_latest_rpi "" "testing"
# docker_manifest_list_testing_or_latest_rpi_python2 "" "testing"
# docker_manifest_list_testing_or_latest_rpi_python3 "" "testing"
# docker_manifest_list_testing_or_latest_rpi "" "testing"
docker_manifest_list_testing_or_latest_python2 "" "testing"
docker_manifest_list_testing_or_latest_python3 "" "testing"
docker_manifest_list_testing_or_latest "" "testing"
fi
;;
*)
echo "DOCKER MANIFEST: Create and Push docker manifest list LATEST Node JS."
docker_manifest_list_testing_or_latest_rpi_python2 ${1} "latest"
docker_manifest_list_testing_or_latest_rpi_python3 ${1} "latest"
docker_manifest_list_testing_or_latest_rpi ${1} "latest"
# docker_manifest_list_testing_or_latest_rpi_python2 ${1} "latest"
# docker_manifest_list_testing_or_latest_rpi_python3 ${1} "latest"
# docker_manifest_list_testing_or_latest_rpi ${1} "latest"
docker_manifest_list_testing_or_latest_python2 ${1} "latest"
docker_manifest_list_testing_or_latest_python3 ${1} "latest"
docker_manifest_list_testing_or_latest ${1} "latest"

if [[ ${1} == "-10" ]]; then
echo "DOCKER MANIFEST: Create and Push docker manifest list LATEST."
docker_manifest_list_testing_or_latest_rpi_python2 "" "latest"
docker_manifest_list_testing_or_latest_rpi_python3 "" "latest"
docker_manifest_list_testing_or_latest_rpi "" "latest"
# docker_manifest_list_testing_or_latest_rpi_python2 "" "latest"
# docker_manifest_list_testing_or_latest_rpi_python3 "" "latest"
# docker_manifest_list_testing_or_latest_rpi "" "latest"
docker_manifest_list_testing_or_latest_python2 "" "latest"
docker_manifest_list_testing_or_latest_python3 "" "latest"
docker_manifest_list_testing_or_latest "" "latest"
Expand All @@ -170,41 +161,41 @@ docker_manifest_list() {
# docker_manifest_list_version_os_arch
}

docker_manifest_list_version_rpi_python2() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi-python2."
docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6-python2 \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7-python2

docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi-python2
}

docker_manifest_list_version_rpi_python3() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi-python3."
docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6-python3 \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7-python3

docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi-python3
}

docker_manifest_list_version_rpi() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi."
docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6 \
${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7

docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi
}
#docker_manifest_list_version_rpi_python2() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi-python2."
# docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6-python2 \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7-python2
#
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi-python2
#}
#
#docker_manifest_list_version_rpi_python3() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi-python3."
# docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6-python3 \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7-python3
#
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi-python3
#}
#
#docker_manifest_list_version_rpi() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-rpi."
# docker manifest create ${TARGET}:${BUILD_VERSION}${1}-rpi \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v6 \
# ${TARGET}:${BUILD_VERSION}${1}-alpine-arm32v7
#
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${BUILD_VERSION}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${BUILD_VERSION}${1}-rpi
#}

docker_manifest_list_version_python2() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${BUILD_VERSION}${1}-python2."
Expand Down Expand Up @@ -251,41 +242,41 @@ docker_manifest_list_version() {
docker manifest push ${TARGET}:${BUILD_VERSION}${1}
}

docker_manifest_list_testing_or_latest_rpi_python2() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi-python2."
docker manifest create ${TARGET}:${2}${1}-rpi-python2 \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2

docker manifest annotate ${TARGET}:${2}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${2}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${2}${1}-rpi-python2
}

docker_manifest_list_testing_or_latest_rpi_python3() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi-python3."
docker manifest create ${TARGET}:${2}${1}-rpi-python3 \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3

docker manifest annotate ${TARGET}:${2}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${2}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${2}${1}-rpi-python3
}

docker_manifest_list_testing_or_latest_rpi() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi."
docker manifest create ${TARGET}:${2}${1}-rpi \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 \
${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7

docker manifest annotate ${TARGET}:${2}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 --os=linux --arch=arm --variant=v6
docker manifest annotate ${TARGET}:${2}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7 --os=linux --arch=arm --variant=v7

docker manifest push ${TARGET}:${2}${1}-rpi
}
#docker_manifest_list_testing_or_latest_rpi_python2() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi-python2."
# docker manifest create ${TARGET}:${2}${1}-rpi-python2 \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2
#
# docker manifest annotate ${TARGET}:${2}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python2 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${2}${1}-rpi-python2 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python2 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${2}${1}-rpi-python2
#}
#
#docker_manifest_list_testing_or_latest_rpi_python3() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi-python3."
# docker manifest create ${TARGET}:${2}${1}-rpi-python3 \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3
#
# docker manifest annotate ${TARGET}:${2}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6-python3 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${2}${1}-rpi-python3 ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7-python3 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${2}${1}-rpi-python3
#}
#
#docker_manifest_list_testing_or_latest_rpi() {
# echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-rpi."
# docker manifest create ${TARGET}:${2}${1}-rpi \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 \
# ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7
#
# docker manifest annotate ${TARGET}:${2}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v6 --os=linux --arch=arm --variant=v6
# docker manifest annotate ${TARGET}:${2}${1}-rpi ${TARGET}:${BUILD_VERSION}${1:--10}-alpine-arm32v7 --os=linux --arch=arm --variant=v7
#
# docker manifest push ${TARGET}:${2}${1}-rpi
#}

docker_manifest_list_testing_or_latest_python2() {
echo "DOCKER MANIFEST: Create and Push docker manifest list - ${TARGET}:${2}${1}-python2."
Expand Down
8 changes: 0 additions & 8 deletions .docker/scripts/install_devtools.sh

This file was deleted.

20 changes: 11 additions & 9 deletions .docker/scripts/install_python_gpio.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
#!/bin/bash
set -ex

# Install Python2
if [[ ${PYTHON_VERSION} == "2" ]]; then
echo "Installing Python 2"
apk add --no-cache python
else
echo "Skip installing Python 2"
fi

# Install Python3
if [[ ${PYTHON_VERSION} == "3" ]]; then
echo "Installing Python 3"
apk add --no-cache python3
apk add --no-cache--virtual .builds-deps build-base
echo "Fixing Python 3 symlink"
ln -s /usr/bin/python3 /usr/bin/python
else
echo "Skip installing Python 3"
fi

# Install Python2
if [[ ${PYTHON_VERSION} == "2" ]]; then
echo "Installing Python 2"
apk add --no-cache python
apk add --no-cache--virtual .builds-deps build-base
else
echo "Skip installing Python 2"
fi

# Install rpigpio library for arm
if [[ ${PYTHON_VERSION} != "0" ]]; then
if [[ ${ARCH} == "arm32v6" ]] || [[ ${ARCH} == "arm32v7" ]]; then
echo "Installing py-rpigpio"
apk add py-rpigpio
apk add --no-cache py-rpigpio
else
echo "Skip installing py-rpigpio"
fi
Expand Down
8 changes: 8 additions & 0 deletions .docker/scripts/uninstall_devtools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -ex

# Uninstall Devtools
if [[ ${DEVTOOLS} == "0" ]]; then
echo "Deleting Devtools"
apk del .builds-deps
fi
Loading

0 comments on commit 6cf0fa6

Please sign in to comment.