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

POC of replacing wget during docker build #5650

Open
wants to merge 2 commits into
base: improvement/migration-java-8-17
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 'make' will build docker images and try to run it.
default: update-props build-stable up-test-mode

.PHONY: update-props update-props-blue update-props-green update-props-dryrun build-confd
.PHONY: build-libs update-props update-props-blue update-props-green update-props-dryrun build-confd

CONFD_DOCKER_COMMAND := docker run --rm -v $(shell pwd):$(shell pwd) -w $(shell pwd) -u $(shell id -u):$(shell id -g) -e HOSTNAME=$(shell hostname) kilda/confd

Expand All @@ -26,4 +26,7 @@ update-props-green: $(BUILD_CONFD)
update-props-dryrun: $(BUILD_CONFD)
$(UPDATE_PROPS) -noop

build-libs:
cd docker && bash libs.sh

include generated.mk
2 changes: 2 additions & 0 deletions docker/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Docker build foilder
BUILD/*
lib/
libs/
base/kilda-base-lab-service/merged-requirements.txt
lab-service/*.whl
lab-service/log.json
Expand Down
6 changes: 4 additions & 2 deletions docker/db-migration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020 Telstra Open Source
# Copyright 2024 Telstra Open Source
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,11 +36,12 @@ USER liquibase

# Latest Liquibase Release Version
ARG LIQUIBASE_VERSION=3.5.5
COPY --chown=liquibase:liquibase lib/liquibase-${LIQUIBASE_VERSION}.tar.g[z] liquibase-${LIQUIBASE_VERSION}.tar.gz

# Download, verify, extract
ARG LB_SHA256=da0df7f6ea7694fb62b1448c3c734644d8d49795ff9bb7417db18bb1da5ff2c6
RUN set -x \
&& wget -O liquibase-${LIQUIBASE_VERSION}.tar.gz "https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz" \
&& wget -N -O liquibase-${LIQUIBASE_VERSION}.tar.gz "https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz" \
&& echo "$LB_SHA256 liquibase-${LIQUIBASE_VERSION}.tar.gz" | sha256sum -c - \
&& tar -xzf liquibase-${LIQUIBASE_VERSION}.tar.gz \
&& rm liquibase-${LIQUIBASE_VERSION}.tar.gz
Expand All @@ -49,6 +50,7 @@ RUN set -x \
RUN GNUPGHOME="$(mktemp -d)"

# Download JDBC libraries and plugins
COPY --chown=liquibase:liquibase lib/* /liquibase/lib/

RUN set -x \
&& mkdir -p /liquibase/lib/ \
Expand Down
32 changes: 32 additions & 0 deletions docker/db-migration/libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

LIBS=lib

[ ! -d $LIBS ] && mkdir $LIBS

LIQUIBASE_VERSION=3.5.5
LIQUIBASE_SHA256=da0df7f6ea7694fb62b1448c3c734644d8d49795ff9bb7417db18bb1da5ff2c6
LIQUIBASE_URL="https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz"
[ ! -f $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz ] \
&& wget -nc -nv -O $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz $LIQUIBASE_URL \
&& echo "$LIQUIBASE_SHA256 $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz" | sha256sum -c

[ ! -f $LIBS/orientdb-jdbc-3.0.34-all.jar ] \
&& wget -nc -nv -O $LIBS/orientdb-jdbc-3.0.34-all.jar \
"https://repo1.maven.org/maven2/com/orientechnologies/orientdb-jdbc/3.0.34/orientdb-jdbc-3.0.34-all.jar" \
&& wget -nc -nv -O $LIBS/commons-lang3-3.6.jar \
"https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.6/commons-lang3-3.6.jar" \
&& wget -nc -nv -O $LIBS/commons-beanutils-1.9.2.jar \
"https://repo1.maven.org/maven2/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar" \
&& wget -nc -nv -O $LIBS/guava-23.3-jre.jar \
"https://repo1.maven.org/maven2/com/google/guava/guava/23.3-jre/guava-23.3-jre.jar" \
&& wget -nc -nv -O $LIBS/validation-api-1.1.0.Final.jar \
"https://repo1.maven.org/maven2/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar" \
&& wget -nc -nv -O $LIBS/hibernate-validator-5.2.4.Final.jar \
"https://repo1.maven.org/maven2/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar" \
&& wget -nc -nv -O $LIBS/jackson-databind-2.6.7.jar \
"https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.6.7/jackson-databind-2.6.7.jar" \
&& wget -nc -nv -O $LIBS/jboss-logging-3.2.1.Final.jar \
"https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.2.1.Final/jboss-logging-3.2.1.Final.jar" \
&& wget -nc -nv -O $LIBS/classmate-1.1.0.jar \
"https://repo1.maven.org/maven2/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar" \
32 changes: 32 additions & 0 deletions docker/db-mysql-migration/libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

LIBS=lib

[ ! -d $LIBS ] && mkdir $LIBS

LIQUIBASE_VERSION=3.5.5
LIQUIBASE_SHA256=da0df7f6ea7694fb62b1448c3c734644d8d49795ff9bb7417db18bb1da5ff2c6
LIQUIBASE_URL="https://github.com/liquibase/liquibase/releases/download/liquibase-parent-${LIQUIBASE_VERSION}/liquibase-${LIQUIBASE_VERSION}-bin.tar.gz"
[ ! -f $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz ] \
&& wget -nc -nv -O $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz $LIQUIBASE_URL \
&& echo "$LIQUIBASE_SHA256 $LIBS/liquibase-${LIQUIBASE_VERSION}.tar.gz" | sha256sum -c

[ ! -f $LIBS/orientdb-jdbc-3.0.34-all.jar ] \
&& wget -nc -nv -O $LIBS/orientdb-jdbc-3.0.34-all.jar \
"https://repo1.maven.org/maven2/com/orientechnologies/orientdb-jdbc/3.0.34/orientdb-jdbc-3.0.34-all.jar" \
&& wget -nc -nv -O $LIBS/commons-lang3-3.6.jar \
"https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.6/commons-lang3-3.6.jar" \
&& wget -nc -nv -O $LIBS/commons-beanutils-1.9.2.jar \
"https://repo1.maven.org/maven2/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar" \
&& wget -nc -nv -O $LIBS/guava-23.3-jre.jar \
"https://repo1.maven.org/maven2/com/google/guava/guava/23.3-jre/guava-23.3-jre.jar" \
&& wget -nc -nv -O $LIBS/validation-api-1.1.0.Final.jar \
"https://repo1.maven.org/maven2/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar" \
&& wget -nc -nv -O $LIBS/hibernate-validator-5.2.4.Final.jar \
"https://repo1.maven.org/maven2/org/hibernate/hibernate-validator/5.2.4.Final/hibernate-validator-5.2.4.Final.jar" \
&& wget -nc -nv -O $LIBS/jackson-databind-2.6.7.jar \
"https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.6.7/jackson-databind-2.6.7.jar" \
&& wget -nc -nv -O $LIBS/jboss-logging-3.2.1.Final.jar \
"https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.2.1.Final/jboss-logging-3.2.1.Final.jar" \
&& wget -nc -nv -O $LIBS/classmate-1.1.0.jar \
"https://repo1.maven.org/maven2/com/fasterxml/classmate/1.1.0/classmate-1.1.0.jar" \
13 changes: 13 additions & 0 deletions docker/libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

images=("db-migration" "db-mysql-migration")

for image in "${images[@]}"; do
echo "Start downloading library dependencies for $image ..."
sh "$image/libs.sh"
mkdir -p libs/$image/ && cp lib/* libs/$image/ && rm -rf lib
mkdir -p $image/lib/ && cp libs/$image/* $image/lib
echo "Finished downloading library dependencies for $image !!! OK"
done
rm -rf libs

Loading