Skip to content
Snippets Groups Projects
Unverified Commit 9c80f05c authored by Piers Harding's avatar Piers Harding
Browse files

ST-915: add in alpine rework


Signed-off-by: default avatarPiers Harding <piers@ompka.net>
parent 1c572137
No related branches found
No related tags found
No related merge requests found
Showing
with 677 additions and 144 deletions
image: $SKA_K8S_TOOLS_DOCKER_BUILDER_IMAGE
stages:
- build_0
# - build_0
- build_1
- build_2
- build_3
- build_4
- build_5
# - build_2
# - build_3
# - build_4
# - build_5
# - push
- test
- publish
......@@ -48,18 +48,35 @@ build_dependencies-alpine:
changes:
- docker/tango/tango-dependencies-alpine/**/*
# build_tango-db:
# retry: 2
# stage: build_1
# variables:
# IMAGE_FOLDER: tango/tango-db
# tags:
# - k8srunner
# script:
# - *build_push
# only:
# changes:
# - docker/tango/tango-db/**/*
build_tango-db:
retry: 2
stage: build_1
variables:
IMAGE_FOLDER: tango/tango-db
tags:
- k8srunner
script:
- *build_push
only:
changes:
- docker/tango/tango-db/**/*
build_tango-db-alpine:
retry: 2
stage: build_1
variables:
IMAGE_FOLDER: tango/tango-db-alpine
tags:
- k8srunner
script:
- *build_push
only:
changes:
- docker/tango/tango-db-alpine/**/*
# build_tango-cpp:
# retry: 2
......@@ -289,6 +306,19 @@ build_dependencies-alpine:
# - docker/tango/pytango-runtime/**/*
# - docker/tango/tango-dsconfig/**/*
build_tango-dsconfig-alpine:
retry: 2
stage: build_5
variables:
IMAGE_FOLDER: tango/tango-dsconfig-alpine
tags:
- k8srunner
script:
- *build_push
only:
changes:
- docker/tango/tango-dsconfig-alpine/**/*
# build_tango-itango:
# retry: 2
# stage: build_5
......@@ -306,6 +336,19 @@ build_dependencies-alpine:
# - docker/tango/pytango-runtime/**/*
# - docker/tango/tango-itango/**/*
build_tango-itango-alpine:
retry: 2
stage: build_5
variables:
IMAGE_FOLDER: tango/tango-itango-alpine
tags:
- k8srunner
script:
- *build_push
only:
changes:
- docker/tango/tango-itango-alpine/**/*
# build_tango-vnc:
# retry: 2
# stage: build_5
......@@ -338,6 +381,20 @@ build_dependencies-alpine:
# - docker/tango/pytango-runtime/**/*
# - docker/tango/tango-pytango/**/*
build_tango-pytango-alpine:
retry: 2
stage: build_5
variables:
IMAGE_FOLDER: tango/tango-pytango-alpine
tags:
- k8srunner
script:
- *build_push
only:
changes:
- docker/tango/tango-pytango-alpine/**/*
# build_tango-panic:
# retry: 2
# stage: build_5
......
.make @ d71064ca
Subproject commit d3cb4dfa38ae28470ba7dc8420cef65069d59fc6
Subproject commit d71064ca62234cdf1d96c19a818e698f63138817
......@@ -126,8 +126,8 @@ tangodb:
intent: production
image:
registry: artefact.skao.int
image: ska-tango-images-tango-db
tag: 10.4.13
image: ska-tango-images-tango-db-alpine
tag: 0.0.2
pullPolicy: IfNotPresent
db:
rootpw: secret
......
release=0.2.0
tag=ska-tango-images-pytango-builder-alpine-0.2.0
release=0.2.5
tag=ska-tango-images-pytango-builder-alpine-0.2.5
\ No newline at end of file
ARG CAR_OCI_REGISTRY_HOST
ARG BASE_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-cpp-alpine:0.2.0"
ARG CAR_OCI_REGISTRY_HOST
ARG BASE_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-cpp-alpine:0.2.15"
FROM $BASE_IMAGE
LABEL \
author="Piers Harding <Piers.Harding@skao.int>" \
description="This image illustrates build dependencies" \
......@@ -13,8 +14,8 @@ USER root
# Install build time dependencies
RUN apk add --update --no-cache curl \
openssl ca-certificates \
boost py3-distutils-extra python3 zlib-dev py3-pip boost-python3 boost-dev libzmq
RUN apk add --no-cache --virtual build-dependencies \
boost py3-distutils-extra python3 zlib-dev py3-pip boost-python3 boost-dev libzmq libsodium-dev
RUN apk add --no-cache --virtual build-dependencies libsodium-dev\
build-base alpine-sdk \
linux-headers \
git make
......@@ -27,13 +28,20 @@ WORKDIR /app
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
# Install numpy manually before PyTango and other requirements to ensure we
# build PyTango with numpy support.
RUN python3.10 -m pip install numpy==1.21.0
# WARNING DANGER WILL ROBINSON!!!!
# link python39 boost to 310 and flat
RUN ln -s /usr/lib/libboost_python39.so.1.76.0 /usr/lib/libboost_python310.so && \
ln -s /usr/lib/libboost_python39.so.1.76.0 /usr/lib/libboost_python.so
# yarl and multidict need also to be added here
RUN MULTIDICT_NO_EXTENSIONS=1 python3 -m pip install multidict \
&& YARL_NO_EXTENSIONS=1 python3 -m pip install yarl \
&& python3 -m pip install numpy==1.21.0
# now install build requirements
COPY requirements.txt /requirements.txt
RUN python3.10 -m pip install -r /requirements.txt
RUN python3.9 -m pip install -r /requirements.txt
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib
RUN mkdir -p /etc/ld.so.conf.d && \
echo "include /etc/ld.so.conf.d/*.conf" > /etc/ld.so.conf && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/tango.conf && \
echo "/usr/local/lib64" > /etc/ld.so.conf.d/tango.conf && \
ldconfig /etc/ld.so.conf.d
RUN mkdir /venv && ln -s /usr/* /venv/ && ln -s /usr/local/bin/itango3 /venv/bin/itango3
numpy==1.21.0
pytango==9.3.3
ipython==7.21.0
flake8
flake8_formatter_junit_xml
ipython==7.27.0
itango==0.1.8
coverage
docutils
MarkupSafe
Pygments
pylint
pytest
pytest-bdd
pytest-cov
pytest-forked
pytest-json-report
pytest-mock
pytest-pycodestyle
pytest-pydocstyle
pytest-pylint
pytest-runner
python-dotenv>=0.5.1
ptvsd
Sphinx
sphinx_rtd_theme
sphinx-autobuild
sphinxcontrib-websupport
requests
tox
transitions
......@@ -13,10 +13,19 @@ LABEL \
int.skao.application="Tango Runtime"
USER root
# Install build time dependencies
RUN apk add --update --no-cache curl \
openssl ca-certificates \
boost py3-distutils-extra python3 py3-pip boost-python3 make libzmq
COPY --from=buildenv /usr/local/lib/python3.10 /usr/local/lib/python3.10
RUN apk add --update --no-cache \
bash \
boost \
boost-python3 \
ca-certificates \
curl \
libzmq \
make \
openssl \
py3-distutils-extra \
py3-pip \
python3
COPY --from=buildenv /usr/local/lib/python3.9 /usr/local/lib/python3.9
COPY pip.conf /etc/pip.conf
......@@ -28,7 +37,10 @@ RUN mkdir -p /etc/ld.so.conf.d && \
echo "/usr/local/lib64" > /etc/ld.so.conf.d/tango.conf && \
ldconfig /etc/ld.so.conf.d
RUN mkdir /venv && ln -s /usr/* /venv/ && ln -s /usr/bin/python3 /venv/bin/python && ln -s /usr/local/bin/itango3 /venv/bin/itango3
RUN mkdir /venv && \
ln -s /usr/* /venv/ && \
ln -s /usr/bin/python3 /venv/bin/python && \
ln -s /usr/local/bin/itango3 /venv/bin/itango3
USER tango
ENV PATH="/home/tango/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
......
release=9.3.13
tag=ska-tango-images-pytango-runtime-9.3.13
release=0.2.5
tag=ska-tango-images-pytango-runtime-alpine-0.2.5
\ No newline at end of file
#
# This Dockerfile creates a Docker image intended to be a base runtime for SKA
# python projects. This image should be used as an intermediate layer
# alongside the pytango-builder image.
#
ARG CAR_PYPI_REPOSITORY_URL
ARG CAR_OCI_REGISTRY_HOST
ARG BUILDER_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-pytango-builder:9.3.13"
ARG BASE_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-cpp:9.3.7"
ARG BUILDER_BASE_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-pytango-builder-alpine:0.2.5"
ARG BASE_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-cpp-alpine:0.2.15"
FROM $BUILDER_BASE_IMAGE AS buildenv
FROM ${BUILDER_IMAGE} as buildenv
FROM $BASE_IMAGE
LABEL \
author="Matteo Di Carlo <matteo.dicarlo@inaf.it>" \
description="This image includes the pytango framework with all its dependencies and no building tools" \
license="BSD-3-Clause" \
registry="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-pytango-runtime" \
org.skatelescope.team="Systems Team" \
org.skatelescope.version="1.0.0" \
int.skao.application="PyTango Runtime"
author="Piers Harding <Piers.Harding@skao.int>" \
description="This image illustrates build dependencies" \
license="Apache2.0" \
int.skao.team="Systems Team" \
int.skao.website="https://gitlab.com/ska-telescope/sdi/ska-ser-containerisation-and-orchestration" \
int.skao.application="Tango Runtime"
USER root
ENV DEBIAN_FRONTEND=noninteractive
# Permanently install Python and PyTango runtime dependencies:
#
# * libboost-python is required by PyTango;
# * make is required to manage execution of the tests inside the container
# * python3 is required as this image is intended for running Python Tango
# devices.
#
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
libboost-python1.67.0 \
ca-certificates \
make \
curl \
python3 \
python3-distutils
# Install build time dependencies
RUN apk add --update --no-cache curl bash \
openssl ca-certificates \
boost py3-distutils-extra python3 py3-pip boost-python3 make libzmq
# Copy across files that are used to help orchestrate container compositions
# and test execution sequences
COPY --from=buildenv /usr/local/bin/wait-for-it.sh /usr/local/bin/wait-for-it.sh
COPY --from=buildenv /usr/local/bin/retry /usr/local/bin/retry
COPY --from=buildenv /usr/local/lib/python3.7 /usr/local/lib/python3.7
COPY --from=buildenv /usr/local/lib/python3.8 /usr/local/lib/python3.8
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py
COPY pip.conf /etc/pip.conf
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib
RUN mkdir -p /etc/ld.so.conf.d && \
echo "include /etc/ld.so.conf.d/*.conf" > /etc/ld.so.conf && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/tango.conf && \
echo "/usr/local/lib64" > /etc/ld.so.conf.d/tango.conf && \
ldconfig /etc/ld.so.conf.d
RUN mkdir /venv && ln -s /usr/* /venv/ && ln -s /usr/bin/python3 /venv/bin/python && ln -s /usr/local/bin/itango3 /venv/bin/itango3
USER tango
ENV PATH="/home/tango/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
ONBUILD COPY --chown=tango:tango . /app
ONBUILD COPY --from=buildenv /usr/local/bin/ /usr/local/bin/
ONBUILD WORKDIR /app
\ No newline at end of file
release=0.2.1
tag=ska-tango-images-tango-cpp-alpine-0.2.1
release=0.2.15
tag=ska-tango-images-tango-cpp-alpine-0.2.15
\ No newline at end of file
ARG CAR_OCI_REGISTRY_HOST
ARG BUILDER_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-dependencies-alpine:0.1.1"
ARG BASE_IMAGE="python:3.8.10-alpine3.13"
FROM $BUILDER_IMAGE AS buildenv
ARG BASE_IMAGE="python:3.8.12-alpine3.14"
ARG BUILD_IMAGE="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-dependencies-alpine:0.2.1"
FROM $BUILD_IMAGE AS buildenv
# Install build time dependencies
RUN apk add --update --no-cache curl \
openssl ca-certificates \
file pkgconf-dev \
g++ python3-dev make czmq-dev \
libffi-dev openssl-dev boost-dev
file mariadb-connector-c-dev pkgconf-dev \
g++ python3-dev python3 make czmq-dev \
libffi-dev openssl-dev boost-dev libsodium-dev
RUN apk add --virtual build-dependencies \
build-base alpine-sdk \
linux-headers \
git cmake
# build and install tangoidl
RUN mkdir /usr/src && cd /usr/src && \
git clone https://gitlab.com/tango-controls/tango-idl && \
cd tango-idl && \
mkdir build && \
cd build && \
cmake .. && \
make install
# build and install cppTango
# git checkout 9.3.4 - only head works at the moment
RUN cd /usr/src && \
git clone https://gitlab.com/tango-controls/cppTango && \
cd cppTango && \
sed -i '1s/^/#include <sys\/types.h>\n#include <bits\/alltypes.h>\n/' /usr/src/cppTango/log4tango/include/log4tango/FileAppender.hh && \
RUN git clone --depth 1 https://gitlab.com/tango-controls/tango-idl.git /idl && \
cmake -B /idl/build -DCMAKE_INSTALL_PREFIX=/usr/local/ /idl && \
make -C /idl/build install
## build and install cppTango
## latest main version is not working using previous commit
RUN git clone https://gitlab.com/tango-controls/cppTango /cppTango && \
cd /cppTango && git checkout 1575524ada0a3f8fe97b4040c07da7c83fced325 && \
sed -i '1s/^/#include <sys\/types.h>\n#include <bits\/alltypes.h>\n/' /cppTango/log4tango/include/log4tango/FileAppender.hh && \
mkdir build && \
cd build && \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig" cmake .. && \
make && \
make install
cmake . -B build \
-DBUILD_TESTING=OFF \
-DCPPZMQ_BASE=/usr/local/ \
-DIDL_BASE=/usr/local/ \
-DOMNI_BASE=/usr/local/ \
-DZMQ_BASE=/usr/local/ && \
make -C build && \
make -C build install
# build and install tango_admin
RUN cd /usr/src && \
git clone https://gitlab.com/tango-controls/tango_admin.git && \
cd tango_admin && \
RUN git clone https://gitlab.com/tango-controls/tango_admin.git /tango_admin && \
cd /tango_admin && \
mkdir build && \
cd build && \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig" cmake .. && \
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig" cmake .. -DBUILD_TESTING=OFF && \
make && \
make install
......@@ -52,11 +53,16 @@ LABEL \
int.skao.team="Systems Team" \
int.skao.website="https://gitlab.com/ska-telescope/sdi/ska-ser-containerisation-and-orchestration" \
int.skao.application="Tango CPP"
# copy the built library dependencies from the builder stage
COPY --from=buildenv /usr/local /usr/local
RUN apk add --update --no-cache mariadb-connector-c musl-utils sudo
RUN ln -s /usr/local/lib/libtango.so.9.4.0 /usr/local/lib/libtango.so.9
RUN adduser -h /home/tango -D tango
RUN echo "tango ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/tango \
&& chmod 0440 /etc/sudoers.d/tango
# create the user tango and add it to sudoers, for some reason we need to add it to the tango group
RUN adduser -h /home/tango -D tango && \
echo "tango ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/tango
USER tango
#!/usr/bin/env bash
GETOPT_BIN=$IN_GETOPT_BIN
GETOPT_BIN=${GETOPT_BIN:-getopt}
__sleep_amount() {
if [ -n "$constant_sleep" ]; then
sleep_time=$constant_sleep
else
#TODO: check for awk
#TODO: check if user would rather use one of the other possible dependencies: python, ruby, bc, dc
sleep_time=`awk "BEGIN {t = $min_sleep * $(( (1<<($attempts -1)) )); print (t > $max_sleep ? $max_sleep : t)}"`
fi
}
__log_out() {
echo "$1" 1>&2
}
# Paramters: max_tries min_sleep max_sleep constant_sleep fail_script EXECUTION_COMMAND
retry()
{
local max_tries="$1"; shift
local min_sleep="$1"; shift
local max_sleep="$1"; shift
local constant_sleep="$1"; shift
local fail_script="$1"; shift
if [ -n "$VERBOSE" ]; then
__log_out "Retry Parameters: max_tries=$max_tries min_sleep=$min_sleep max_sleep=$max_sleep constant_sleep=$constant_sleep"
if [ -n "$fail_script" ]; then __log_out "Fail script: $fail_script"; fi
__log_out ""
__log_out "Execution Command: $*"
__log_out ""
fi
local attempts=0
local return_code=1
while [[ $return_code -ne 0 && $attempts -le $max_tries ]]; do
if [ $attempts -gt 0 ]; then
__sleep_amount
__log_out "Before retry #$attempts: sleeping $sleep_time seconds"
sleep $sleep_time
fi
P="$1"
for param in "${@:2}"; do P="$P '$param'"; done
#TODO: replace single quotes in each arg with '"'"' ?
export RETRY_ATTEMPT=$attempts
# Propagate signals to child process and stop further attempts
# on SIGTERM and SIGINT
bash -c "$P" &
child_pid=$!
__term() {
kill -SIGTERM $child_pid
attempts=$max_tries
}
__int() {
kill -SIGINT $child_pid
attempts=$max_tries
}
trap __term SIGTERM
trap __int SIGINT
wait $child_pid
return_code=$?
#__log_out "Process returned $return_code on attempt $attempts"
if [ $return_code -eq 127 ]; then
# command not found
exit $return_code
elif [ $return_code -ne 0 ]; then
attempts=$[$attempts +1]
fi
done
if [ $attempts -gt $max_tries ]; then
if [ -n "$fail_script" ]; then
__log_out "Retries exhausted, running fail script"
eval $fail_script
else
__log_out "Retries exhausted"
fi
fi
exit $return_code
}
# If we're being sourced, don't worry about such things
if [ "$BASH_SOURCE" == "$0" ]; then
# Prints the help text
help()
{
local retry=$(basename $0)
cat <<EOF
Usage: $retry [options] -- execute command
-h, -?, --help
-v, --verbose Verbose output
-t, --tries=# Set max retries: Default 10
-s, --sleep=secs Constant sleep amount (seconds)
-m, --min=secs Exponenetial Backoff: minimum sleep amount (seconds): Default 0.3
-x, --max=secs Exponenetial Backoff: maximum sleep amount (seconds): Default 60
-f, --fail="script +cmds" Fail Script: run in case of final failure
EOF
}
# show help for no arguments if stdin is a terminal
if { [ -z "$1" ] && [ -t 0 ] ; } || [ "$1" == '-h' ] || [ "$1" == '-?' ] || [ "$1" == '--help' ]
then
help
exit 0
fi
$GETOPT_BIN --test > /dev/null
if [[ $? -ne 4 ]]; then
echo "I’m sorry, 'getopt --test' failed in this environment. Please load GNU getopt."
exit 1
fi
OPTIONS=vt:s:m:x:f:
LONGOPTIONS=verbose,tries:,sleep:,min:,max:,fail:
PARSED=$($GETOPT_BIN --options="$OPTIONS" --longoptions="$LONGOPTIONS" --name "$0" -- "$@")
if [[ $? -ne 0 ]]; then
# e.g. $? == 1
# then getopt has complained about wrong arguments to stdout
exit 2
fi
# read getopt’s output this way to handle the quoting right:
eval set -- "$PARSED"
max_tries=10
min_sleep=0.3
max_sleep=60.0
constant_sleep=
fail_script=
# now enjoy the options in order and nicely split until we see --
while true; do
case "$1" in
-v|--verbose)
VERBOSE=true
shift
;;
-t|--tries)
max_tries="$2"
shift 2
;;
-s|--sleep)
constant_sleep="$2"
shift 2
;;
-m|--min)
min_sleep="$2"
shift 2
;;
-x|--max)
max_sleep="$2"
shift 2
;;
-f|--fail)
fail_script="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "Programming error"
exit 3
;;
esac
done
retry "$max_tries" "$min_sleep" "$max_sleep" "$constant_sleep" "$fail_script" "$@"
fi
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
cmdname=$(basename $0)
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
Usage:
$cmdname host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST Host or IP under test
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}
wait_for()
{
if [[ $TIMEOUT -gt 0 ]]; then
echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
else
echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
fi
start_ts=$(date +%s)
while :
do
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
result=$?
if [[ $result -eq 0 ]]; then
end_ts=$(date +%s)
echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
break
fi
sleep 1
done
return $result
}
wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
timeout $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
else
timeout $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
fi
PID=$!
trap "kill -INT -$PID" INT
wait $PID
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
fi
return $RESULT
}
# process arguments
while [[ $# -gt 0 ]]
do
case "$1" in
*:* )
hostport=(${1//:/ })
HOST=${hostport[0]}
PORT=${hostport[1]}
shift 1
;;
--child)
CHILD=1
shift 1
;;
-q | --quiet)
QUIET=1
shift 1
;;
-s | --strict)
STRICT=1
shift 1
;;
-h)
HOST="$2"
if [[ $HOST == "" ]]; then break; fi
shift 2
;;
--host=*)
HOST="${1#*=}"
shift 1
;;
-p)
PORT="$2"
if [[ $PORT == "" ]]; then break; fi
shift 2
;;
--port=*)
PORT="${1#*=}"
shift 1
;;
-t)
TIMEOUT="$2"
if [[ $TIMEOUT == "" ]]; then break; fi
shift 2
;;
--timeout=*)
TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
CLI="$@"
break
;;
--help)
usage
;;
*)
echoerr "Unknown argument: $1"
usage
;;
esac
done
if [[ "$HOST" == "" || "$PORT" == "" ]]; then
echoerr "Error: you need to provide a host and port to test."
usage
fi
TIMEOUT=${TIMEOUT:-15}
STRICT=${STRICT:-0}
CHILD=${CHILD:-0}
QUIET=${QUIET:-0}
if [[ $CHILD -gt 0 ]]; then
wait_for
RESULT=$?
exit $RESULT
else
if [[ $TIMEOUT -gt 0 ]]; then
wait_for_wrapper
RESULT=$?
else
wait_for
RESULT=$?
fi
fi
if [[ $CLI != "" ]]; then
if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec $CLI
else
exit $RESULT
fi
release=0.0.2
tag=ska-tango-images-tango-db-alpine-0.0.2
ARG BASE_IMAGE="alpine:3.14"
FROM $BASE_IMAGE AS builder
### Install and Setup Mariadb
ENV LC_ALL=en_GB.UTF-8
RUN mkdir /docker-entrypoint-initdb.d && \
apk -U upgrade && \
apk add --no-cache mariadb mariadb-client && \
apk add --no-cache tzdata && \
# clean up
rm -rf /var/cache/apk/*
# comment out a few problematic configuration values
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/my.cnf && \
sed -i 's/^skip-networking/#&/' /etc/my.cnf.d/mariadb-server.cnf && \
# don't reverse lookup hostnames, they are usually another container
sed -i '/^\[mysqld]$/a skip-host-cache\nskip-name-resolve' /etc/my.cnf && \
# always run as user mysql
sed -i '/^\[mysqld]$/a user=mysql' /etc/my.cnf && \
# allow custom configurations
echo -e '\n!includedir /etc/mysql/conf.d/' >> /etc/my.cnf && \
mkdir -p /etc/mysql/conf.d/
VOLUME /var/lib/mysql
EXPOSE 3306
ENV TANGO_DOWNLOAD_URL=https://artefact.skao.int/repository/raw-internal/ska-tango-images/libraries/tango-9.3.4.tar.gz
RUN apk add --update --no-cache curl \
ca-certificates
RUN mkdir -p /usr/src/tango
WORKDIR /usr/src/tango
RUN curl -fsSL "$TANGO_DOWNLOAD_URL" -o tango.tar.gz && \
tar xf tango.tar.gz -C /usr/src/tango --strip-components=1
# create dump from tango tar gz and move it into the folder docker-entrypoint-initdb.d
RUN mkdir -p dbinit/include \
&& cp cppserver/database/create_db.sql.in dbinit/create_db.sql \
&& cp cppserver/database/create_db_tables.sql.in dbinit/include/create_db_tables.sql \
&& cp cppserver/database/stored_proc.sql.in dbinit/include/stored_proc.sql \
&& sed -i "s|@TANGO_DB_NAME@|tango|g" dbinit/create_db.sql \
&& sed -i "s|@TANGO_DB_NAME@|tango|g" dbinit/include/create_db_tables.sql \
&& sed -i "s|@TANGO_DB_NAME@|tango|g" dbinit/include/stored_proc.sql \
&& sed -i "s|^source create_db_tables.sql$|source /docker-entrypoint-initdb.d/include/create_db_tables.sql|g" dbinit/create_db.sql \
&& sed -i "s|^source stored_proc.sql$|source /docker-entrypoint-initdb.d/include/stored_proc.sql|g" dbinit/create_db.sql \
&& sed -i "/CREATE DATABASE tango;/d" dbinit/create_db.sql \
&& cp -r dbinit/* /docker-entrypoint-initdb.d
RUN rm -r /usr/src/tango
FROM $BASE_IMAGE
### Install and Setup Mariadb
ENV LC_ALL=en_GB.UTF-8
RUN mkdir /docker-entrypoint-initdb.d && \
apk -U upgrade && \
apk add --no-cache mariadb mariadb-client && \
apk add --no-cache tzdata && \
# clean up
rm -rf /var/cache/apk/*
# comment out a few problematic configuration values
RUN sed -Ei 's/^(bind-address|log)/#&/' /etc/my.cnf && \
sed -i 's/^skip-networking/#&/' /etc/my.cnf.d/mariadb-server.cnf && \
# don't reverse lookup hostnames, they are usually another container
sed -i '/^\[mysqld]$/a skip-host-cache\nskip-name-resolve' /etc/my.cnf && \
# always run as user mysql
sed -i '/^\[mysqld]$/a user=mysql' /etc/my.cnf && \
# allow custom configurations
echo -e '\n!includedir /etc/mysql/conf.d/' >> /etc/my.cnf && \
mkdir -p /etc/mysql/conf.d/
VOLUME /var/lib/mysql
EXPOSE 3306
LABEL \
author="Matteo Di Carlo <matteo.dicarlo@inaf.it>" \
description="This image is the tango db (MariaDB) from the TANGO-community" \
license="BSD-3-Clause" \
registry="${CAR_OCI_REGISTRY_HOST}/ska-tango-images-tango-db" \
org.skatelescope.team="Systems Team" \
org.skatelescope.version="1.0.0" \
int.skao.application="Tango DB"
COPY --from=builder /docker-entrypoint-initdb.d /docker-entrypoint-initdb.d
COPY sql_mode.cnf /etc/mysql/conf.d
include ../../make/Makefile
pre-build:
@echo do some stuff before the docker build
post-build:
@echo do some stuff after the docker build
\ No newline at end of file
[mysqld]
sql-mode=""
innodb=OFF
default_storage_engine=MyISAM
release=0.1.1
tag=ska-tango-images-tango-dependencies-alpine-0.1.1
release=0.2.1
tag=ska-tango-images-tango-dependencies-alpine-0.2.1
\ No newline at end of file
......@@ -3,7 +3,7 @@
# intermediate image, then creates a release image containing the compiled
# binaries.
#
ARG BASE_IMAGE="alpine:latest"
ARG BASE_IMAGE="alpine:3.14"
FROM $BASE_IMAGE as buildenv
# Copy across files that are used to help orchestrate container compositions
......@@ -15,44 +15,34 @@ COPY retry.sh /usr/local/bin/retry
RUN apk add --update --no-cache curl \
openssl ca-certificates \
file pkgconf-dev \
g++ python3-dev make czmq-dev \
g++ python3-dev make czmq-dev libsodium-dev \
libffi-dev openssl-dev boost-dev
RUN apk add --virtual build-dependencies \
build-base alpine-sdk \
linux-headers \
git cmake
# build and install libzmq at v4.2.0
RUN mkdir /usr/src && cd /usr/src && \
git clone https://github.com/zeromq/libzmq && \
cd libzmq && \
git checkout v4.2.0 && \
mkdir build && \
cd build && \
cmake -DENABLE_DRAFTS=OFF -DWITH_DOC=OFF -DZMQ_BUILD_TESTS=OFF .. && \
make && \
make install
# build and install libzmq at v4.3.4
RUN git clone -b v4.3.4 --depth 1 https://github.com/zeromq/libzmq /libzmq && \
cmake -B /libzmq/build -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_DRAFTS=OFF -DWITH_DOC=OFF -DZMQ_BUILD_TESTS=OFF /libzmq && \
make -C /libzmq/build install
# build and install cpp zmq at v4.7.1
RUN cd /usr/src && \
git clone https://github.com/zeromq/cppzmq && \
cd cppzmq && \
git checkout v4.7.1 && \
mkdir build && \
cd build && \
cmake -DCPPZMQ_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
make && \
make install
# build and install cpp zmq at v4.8.1
RUN git clone -b v4.8.1 --depth 1 https://github.com/zeromq/cppzmq.git /cppzmq && \
cmake -B /cppzmq/build -DCPPZMQ_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local /cppzmq && \
make -C /cppzmq/build install
# build and install omniORB at 4.2.4
RUN cd /usr/src && \
wget -O - "https://nav.dl.sourceforge.net/project/omniorb/omniORB/omniORB-4.2.4/omniORB-4.2.4.tar.bz2" | tar jxf - && \
cd omniORB-4.2.4 && \
./configure && \
RUN curl -L https://sourceforge.net/projects/omniorb/files/omniORB/omniORB-4.2.4/omniORB-4.2.4.tar.bz2/download -o /omniORB.tar.bz2 && \
mkdir /omniORB && \
tar xaf /omniORB.tar.bz2 --strip-components=1 -C /omniORB && \
cd /omniORB && \
./configure --prefix=/usr/local/ && \
make && \
make install
FROM $BASE_IMAGE
LABEL \
author="Matteo Di Carlo <matteo.dicarlo@inaf.it>" \
description="This image includes all the depenencies needed for installing the TANGO-controls framework" \
......@@ -61,5 +51,6 @@ LABEL \
org.skatelescope.team="Systems Team" \
org.skatelescope.version="1.0.0" \
int.skao.application="Tango dependencies"
COPY --from=buildenv /usr/local /usr/local
release=0.1.0
tag=ska-tango-images-tango-dsconfig-alpine-0.1.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment