Commit 8a8dff52 authored by dgasull's avatar dgasull

Using minimal Kafka docker image

parent 36ad4de8
......@@ -106,10 +106,10 @@ then
docker tag elasticeuh2020/dataclay-dspython:${VERSION}.py37 elasticeuh2020/dataclay-dspython:${VERSION}
echo " ===== Building docker elasticeuh2020/kafka:${VERSION} ====="
docker build --rm -f kafka.Dockerfile --no-cache -t elasticeuh2020/kafka:$VERSION .
docker build --rm -f kafka.Dockerfile -t elasticeuh2020/kafka:$VERSION .
echo " ===== Building docker elasticeuh2020/mqtt-to-dataclay:${VERSION} ====="
docker build --rm -f elastic.mqtt.bridge.Dockerfile --no-cache -t elasticeuh2020/mqtt-to-dataclay:$VERSION .
docker build --rm -f elastic.mqtt.bridge.Dockerfile -t elasticeuh2020/mqtt-to-dataclay:$VERSION .
rm -rf ./contractids
......
......@@ -127,8 +127,6 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
echo " ===== Building docker elasticeuh2020/dataclay-javaclient:${VERSION} ====="
docker buildx build --rm -f elastic.javaclient.Dockerfile --no-cache \
--cache-to=type=registry,ref=elasticeuh2020/dataclay-javaclient:buildxcache${VERSION},mode=max \
--cache-from=type=registry,ref=elasticeuh2020/dataclay-javaclient:buildxcache${VERSION} \
-t elasticeuh2020/dataclay-javaclient:$VERSION --platform $PLATFORMS --push .
echo " ===== Building docker elasticeuh2020/dataclay-logicmodule:${VERSION} ====="
......@@ -145,8 +143,6 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
IMG_VER=${VERSION}.py${DATACLAY_PYVER}
echo " ===== Building docker elasticeuh2020/dataclay-pyclient:${IMG_VER} ====="
docker buildx build --rm -f elastic.pyclient.Dockerfile --no-cache \
--cache-to=type=registry,ref=elasticeuh2020/dataclay-pyclient:buildxcache${VERSION},mode=max \
--cache-from=type=registry,ref=elasticeuh2020/dataclay-pyclient:buildxcache${VERSION} \
--build-arg DATACLAY_PYVER="py${DATACLAY_PYVER}" \
--build-arg PYTHON_VERSION="$PYTHON_VERSION" \
-t elasticeuh2020/dataclay-pyclient:${IMG_VER} \
......@@ -169,14 +165,16 @@ if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
docker buildx imagetools create --tag elasticeuh2020/dataclay-dspython:${VERSION} elasticeuh2020/dataclay-dspython:${VERSION}.py37
echo " ===== Building docker elasticeuh2020/kafka:${VERSION} ====="
docker buildx build --rm -f kafka.Dockerfile --no-cache \
docker buildx build --rm -f kafka.Dockerfile \
-t elasticeuh2020/kafka:$VERSION \
--platform $PLATFORMS --push .
echo " ===== Building docker elasticeuh2020/mqtt-to-dataclay:${VERSION} ====="
docker buildx build --rm -f elastic.mqtt.bridge.Dockerfile --no-cache \
-t elasticeuh2020/mqtt-to-dataclay:$VERSION \
--platform $PLATFORMS --push .
docker buildx build --rm -f elastic.mqtt.bridge.Dockerfile \
--cache-to=type=registry,ref=elasticeuh2020/mqtt-to-dataclay:buildxcache${VERSION},mode=max \
--cache-from=type=registry,ref=elasticeuh2020/mqtt-to-dataclay:buildxcache${VERSION} \
-t elasticeuh2020/mqtt-to-dataclay:$VERSION \
--platform $PLATFORMS --push .
docker logout
docker buildx rm $DOCKER_BUILDER
......
......@@ -2,7 +2,12 @@ FROM elasticeuh2020/dataclay-pyclient:1.4
FROM nuvlabox/mqtt-fiware-bridge:0.0.1
# Install packages:
RUN apt-get update && apt-get install --no-install-recommends -y gcc libc-dev && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install --no-install-recommends -y build-essential gcc libc-dev && rm -rf /var/lib/apt/lists/*
# Install dataClay last version (different layer for grpcio dependency since it takes time)
RUN pip install --upgrade pip
RUN pip install grpcio==1.25.0
RUN pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dataClay
# Get environment from arguments
ENV WORKING_DIR=/opt/nuvlabox
......@@ -20,10 +25,6 @@ ENV DATACLAYCLIENTCONFIG=${WORKING_DIR}/cfgfiles/client.properties \
COPY --from=0 /dataclay-client/fiware-contractid /srv/dataclay/shared/contractid
# Install dataClay last version
RUN pip install --upgrade pip
RUN pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple dataClay
# Copy app
COPY mqtt-to-dataclay/ ${WORKING_DIR}
RUN mkdir -p ${STUBSPATH}
......
FROM ubuntu:18.04
### Extend from ubuntu instead of openjdk specialized image to allow multiple architectures
FROM alpine:latest as build
# Install packages:
RUN apt-get update \
&& apt-get install --no-install-recommends -y --allow-unauthenticated openjdk-11-jdk curl wget jq >/dev/null \
&& rm -rf /var/lib/apt/lists/*
ARG kafka_version=2.6.0
ARG scala_version=2.13
ENV KAFKA_VERSION=$kafka_version
ENV SCALA_VERSION=$scala_version
ENV KAFKA_VERSION=2.4.1
ENV SCALA_VERSION=2.12
RUN apk add --no-cache wget curl jq
RUN FILENAME="kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" \
&& url=$(curl --stderr /dev/null "https://www.apache.org/dyn/closer.cgi?path=/kafka/${KAFKA_VERSION}/${FILENAME}&as_json=1" | jq -r '"\(.preferred)\(.path_info)"') \
&& echo "Downloading Kafka from $url" \
&& wget -q "${url}" -O /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz \
&& tar -xzf /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz -C "/tmp"
# Kafka and Zookeeper
FROM openjdk:8-jre-alpine
ARG kafka_version=2.6.0
ARG scala_version=2.13
ENV KAFKA_VERSION=$kafka_version
ENV SCALA_VERSION=$scala_version
ENV KAFKA_HOME=/opt/kafka
ENV PATH=${PATH}:${KAFKA_HOME}/bin
RUN mkdir -p ${KAFKA_HOME}
# Download kafka
RUN FILENAME="kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" \
&& url=$(curl --stderr /dev/null "https://www.apache.org/dyn/closer.cgi?path=/kafka/${KAFKA_VERSION}/${FILENAME}&as_json=1" | jq -r '"\(.preferred)\(.path_info)"') \
&& echo "Downloading Kafka from $url" \
&& wget -q "${url}" -O /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz \
&& tar -xzf /tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz --directory ${KAFKA_HOME} --strip-components=1
# Start kafka
ENTRYPOINT kafka-server-start.sh ${KAFKA_HOME}/config/server.properties
RUN apk add --no-cache bash
COPY --from=build "/tmp/kafka_${SCALA_VERSION}-${KAFKA_VERSION}" "/opt/kafka"
COPY entrypoints/kafka/entrypoint.sh $KAFKA_HOME/entrypoint.sh
WORKDIR $KAFKA_HOME
# 2181 is zookeeper, 9092 is kafka
EXPOSE 2181 9092
ENTRYPOINT ["./entrypoint.sh"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment