update dockerfiles

- define user uid/gid
- use new geedeecee files (hopefully means smaller images, faster building)
This commit is contained in:
Adam 2022-10-22 19:55:02 +02:00
parent e370cb5ef9
commit 9b331cc105
15 changed files with 95 additions and 119 deletions

View file

@ -1,3 +1,4 @@
import kafkatorio.extensions.dropDirectory
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@ -88,6 +89,14 @@ val runSyslogServer by tasks.registering {
dependsOn(tasks.run)
}
tasks.dockerComposeBuild {
dependsOn(tasks.distTar)
tasks.dockerContextPrepareFiles {
from(zipTree(tasks.distZip.flatMap { it.archiveFile })) {
eachFile {
relativePath = relativePath.dropDirectory()
if (!isDirectory && relativePath.pathString.matches("""bin\/.+""".toRegex())) {
name = name.replace(file.nameWithoutExtension, "run")
}
}
}
}

View file

@ -2,26 +2,22 @@
FROM eclipse-temurin:11-jdk-jammy
ARG KAFKATORIO_VERSION
ARG DIST_DIR="../build/distributions/"
ARG APP_NAME="events-server-syslog"
ARG APP_FILES="build/"
ARG USER_ID=1000
ARG USER_GID=1000
WORKDIR /app
USER $USER_ID:$USER_GID
ENV SERVER_DATA_DIR="/app/data" \
KAFKA_STREAMS_STATE_DIR="/app/state/kafka" \
SOCKET_SERVER_HOST=0.0.0.0 \
SOCKET_SERVER_PORT=9002
ENV SOCKET_SERVER_HOST=0.0.0.0
ENV SOCKET_SERVER_PORT=9002
EXPOSE $SOCKET_SERVER_PORT
ENV SERVER_DATA_DIR="/app/data"
ENV KAFKA_STREAMS_STATE_DIR="/app/state/kafka"
VOLUME ${SERVER_DATA_DIR} \
${KAFKA_STREAMS_STATE_DIR}
COPY ${DIST_DIR}/${APP_NAME}-${KAFKATORIO_VERSION}.tar ${APP_NAME}.tar
RUN tar -xf ${APP_NAME}.tar --strip-components=1 \
&& rm ${APP_NAME}.tar \
&& cp /app/bin/${APP_NAME} /app/bin/run \
&& chmod 775 /app/bin/run
COPY ${APP_FILES} /app/
ENTRYPOINT /app/bin/run

View file

@ -7,12 +7,11 @@ services:
container_name: ${APP_NAME}
restart: unless-stopped
build:
context: ..
dockerfile: ./docker/Dockerfile
context: .
dockerfile: Dockerfile
args:
KAFKATORIO_VERSION: ${KAFKATORIO_VERSION}
DIST_DIR: "./build/distributions/"
APP_NAME: ${APP_NAME}
APP_FILES: "./build/"
environment:
KAFKA_BOOTSTRAP_SERVERS: "http://kafka:29092"
# KAFKA_STREAMS_STATE_DIR: ""