Build Docker image with pyb, dev_notes with ToDo

This commit is contained in:
Mirco 2024-06-13 22:20:25 +02:00
parent e9bc625676
commit 6900a54157
5 changed files with 136 additions and 0 deletions

55
build.py Normal file
View file

@ -0,0 +1,55 @@
from os import environ
from datetime import datetime
from pybuilder.core import task, init
from ddadevops import *
name = 'moderator-election'
MODULE = ''
PROJECT_ROOT_PATH = '../..'
version = "1.0.0-dev"
@init
def initialize(project):
image_tag = version
if "dev" in image_tag:
image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
input = {
"name": name,
"module": "notused",
"stage": "notused",
"project_root_path": PROJECT_ROOT_PATH,
"build_types": ["IMAGE"],
"mixin_types": [],
"image_naming": "NAME_AND_MODULE",
"image_tag": f"{image_tag}",
}
project.build_depends_on("ddadevops>=4.7.0")
build = DevopsImageBuild(project, input)
build.initialize_build_dir()
@task
def image(project):
build = get_devops_build(project)
build.image()
@task
def drun(project):
build = get_devops_build(project)
build.drun()
@task
def test(project):
build = get_devops_build(project)
build.test()
@task
def publish(project):
build = get_devops_build(project)
build.dockerhub_login()
build.dockerhub_publish()

23
doc/dev_notes.md Normal file
View file

@ -0,0 +1,23 @@
### ToDo
```
HowTo BUILD jar?
local: ./gradle build
java -jar build/libs/ModeratorElection.jar -> localhost:6333 "White Label..."-Error
https://docs.gradle.org/current/userguide/gradle_wrapper.html
```
```
build graalvm binary
```
```
after npm audit fix during image build
npm warn deprecated workbox-google-analytics@7.0.0: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
npm warn deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
```

6
image/Dockerfile Normal file
View file

@ -0,0 +1,6 @@
#Build Stage
FROM node:22.3.0-bookworm-slim
ADD resources /tmp
RUN /tmp/install.sh

View file

@ -0,0 +1 @@
Silke,Hans,Dieter,Anne

51
image/resources/install.sh Executable file
View file

@ -0,0 +1,51 @@
#!/bin/bash
set -exo pipefail
function main()
{
upgradeSystem
apt-get -qqy install openjdk-17-jdk-headless git curl unzip
mkdir /usr/local/src/ModeratorElection
git clone --single-branch --branch main https://repo.prod.meissa.de/meissa/ModeratorElection.git /usr/local/src/ModeratorElection
cp /tmp/MEMBERNAMES /usr/local/src/ModeratorElection
#download gradle
#gradle_version="8.4"
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip
#curl -SsLo /tmp/gradle-${gradle_version}-bin.zip.sha256 https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip.sha256
#checksum gradle
#checksum
#install gradle
#mkdir /opt/gradle
#unzip -qqd /opt/gradle /tmp/gradle-${gradle_version}-bin.zip
#export PATH=$PATH:/opt/gradle/gradle-${gradle_version}/bin
#ToDo install graalvm, put graalvm binary here
#install -m 0700 /tmp/entrypoint-start-and-wait.sh /
#install -m 0700 /tmp/init.sh /usr/local/bin/
#install -m 0700 /tmp/backup.sh /usr/local/bin/
#install -m 0700 /tmp/restore.sh /usr/local/bin/
#install -m 0700 /tmp/restic-snapshots.sh /usr/local/bin/
#cleanupDocker
} #> /dev/null
function checksum() {
#gradle
echo " /tmp/gradle-${gradle_version}-bin.zip"|tee -a /tmp/gradle-${gradle_version}-bin.zip.sha256
sha256sum -c --status /tmp/gradle-${gradle_version}-bin.zip.sha256
}
source /tmp/install_functions_debian.sh
DEBIAN_FRONTEND=noninteractive DEBCONF_NOWARNINGS=yes main
cd /usr/local/src/ModeratorElection
#npm install -g npm@latest
#npm audit fix
#npm ci --omit=dev
#./gradlew build