3: Remove support for Docker
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
JREVERSION=25.0.2-0
|
||||
|
||||
export VERSION=$(git describe --tags --exact-match 2>/dev/null \
|
||||
|| git symbolic-ref --short -q HEAD \
|
||||
|| git rev-parse --short HEAD)
|
||||
|
||||
GITHASH=$(git rev-parse --short=8 HEAD)
|
||||
|
||||
echo "Preparing Docker image for '${VERSION}'..."
|
||||
|
||||
mkdir -p build/docker/{conf,libs}
|
||||
|
||||
cp src/main/docker/run.sh build/docker/run.sh
|
||||
cp libs/*.jar build/docker/libs/
|
||||
cp conf/* build/docker/conf/
|
||||
|
||||
sed \
|
||||
-e "s|_VERSION_|${VERSION}|g" \
|
||||
-e "s|_JREVERSION_|${JREVERSION}|g" \
|
||||
src/main/docker/Dockerfile_template \
|
||||
> build/docker/Dockerfile
|
||||
|
||||
GROUP=r35157
|
||||
NAME=nenjimhub
|
||||
|
||||
BASETAG=dockerreg.r35157.com/${GROUP}/${NAME}
|
||||
|
||||
HASHTAG=${BASETAG}:${GITHASH}_amd64
|
||||
VERSIONTAG=${BASETAG}:${VERSION}_amd64
|
||||
LATESTTAG=${BASETAG}:latest_amd64
|
||||
|
||||
echo "Building ${HASHTAG}..."
|
||||
|
||||
docker buildx build \
|
||||
--load \
|
||||
-t ${HASHTAG} \
|
||||
build/docker
|
||||
|
||||
docker tag ${HASHTAG} ${VERSIONTAG}
|
||||
docker tag ${HASHTAG} ${LATESTTAG}
|
||||
|
||||
sed \
|
||||
-e "s|_HASHTAG_|${HASHTAG}|g" \
|
||||
-e "s|_VERSIONTAG_|${VERSIONTAG}|g" \
|
||||
-e "s|_LATESTTAG_|${LATESTTAG}|g" \
|
||||
src/main/docker/publish_template.sh \
|
||||
> build/docker/publish.sh
|
||||
|
||||
chmod 755 build/docker/publish.sh
|
||||
|
||||
echo ""
|
||||
echo "Docker image ready:"
|
||||
echo " ${HASHTAG}"
|
||||
echo " ${VERSIONTAG}"
|
||||
echo " ${LATESTTAG}"
|
||||
|
||||
@@ -5,10 +5,5 @@ export VERSION=$(git describe --tags --exact-match 2>/dev/null \
|
||||
|| git symbolic-ref --short -q HEAD \
|
||||
|| git rev-parse --short HEAD)
|
||||
|
||||
./docker.sh
|
||||
|
||||
echo "Publishing artifact to local Maven repo ($VERSION)..."
|
||||
./gradlew -Pversion=$VERSION publishToMavenLocal
|
||||
|
||||
echo "Publishing docker container to public 'dockerreg.r35157.com' ($VERSION)..."
|
||||
./build/docker/publish.sh
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
jars=(libs/*.jar)
|
||||
if (( ${#jars[@]} == 0 )); then
|
||||
echo "ERROR: No JARs found in libs/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CLASSPATH=$(IFS=:; echo "${jars[*]}")
|
||||
|
||||
exec java \
|
||||
--enable-preview \
|
||||
-Dlog4j.configurationFile=conf/log4j2.xml \
|
||||
-cp "$CLASSPATH" \
|
||||
com.r35157.nenjim.hubd.impl.ref.Main
|
||||
@@ -1,43 +0,0 @@
|
||||
FROM dockerreg.r35157.com/r35157/jre:_JREVERSION__amd64
|
||||
|
||||
LABEL maintainer="Minimons <minimons@r35157.com>"
|
||||
|
||||
# Setup environment
|
||||
ENV APP_HOME=/usr/local/software/nenjimhub
|
||||
WORKDIR /usr/local/software
|
||||
USER root
|
||||
|
||||
RUN mkdir nenjimhub-_VERSION_ \
|
||||
&& ln -s nenjimhub-_VERSION_ nenjimhub
|
||||
WORKDIR nenjimhub
|
||||
RUN mkdir libs
|
||||
|
||||
# These dirs are expected to be overshadowed by host mounts
|
||||
RUN mkdir conf logs && chown user:user logs
|
||||
|
||||
# Set timezone
|
||||
ENV TZ=Europe/Copenhagen
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y tzdata \
|
||||
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone \
|
||||
&& dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
# Clean-up
|
||||
RUN apt-get autoremove -y \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install application and configuration (Do this as late as possible to be able to reuse layers between builds)
|
||||
COPY run.sh .
|
||||
COPY conf/* conf/
|
||||
COPY libs/*.jar libs/
|
||||
|
||||
RUN chown root:root -R conf
|
||||
RUN chmod 755 ./run.sh \
|
||||
&& chmod -R a+rX /usr/local/software/nenjimhub-_VERSION_
|
||||
|
||||
USER user:user
|
||||
|
||||
CMD ["./run.sh"]
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "Publishing '_HASHTAG_', '_VERSIONTAG_' and '_LATESTTAG_'..."
|
||||
docker push _HASHTAG_
|
||||
docker push _VERSIONTAG_
|
||||
docker push _LATESTTAG_
|
||||
|
||||
echo "Publishing completed!"
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
jars=(libs/*.jar)
|
||||
if (( ${#jars[@]} == 0 )); then
|
||||
echo "ERROR: No JARs found in libs/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CLASSPATH=$(IFS=:; echo "${jars[*]}")
|
||||
|
||||
exec java \
|
||||
--enable-preview \
|
||||
-Dlog4j.configurationFile=conf/log4j2.xml \
|
||||
-cp "$CLASSPATH" \
|
||||
com.r35157.nenjim.hubd.impl.ref.Main
|
||||
@@ -1,19 +0,0 @@
|
||||
version: '3.9'
|
||||
|
||||
services:
|
||||
nenjimhub:
|
||||
hostname: nenjimhub
|
||||
image: dockerreg.r35157.com/r35157/nenjimhub:latest
|
||||
deploy:
|
||||
replicas: 1
|
||||
resources:
|
||||
limits:
|
||||
memory: 128m
|
||||
restart_policy:
|
||||
condition: any
|
||||
delay: 5s
|
||||
max_attempts: 3
|
||||
window: 120s
|
||||
volumes:
|
||||
- /home/op/nenjimhub/conf:/usr/local/software/nenjimhub/conf
|
||||
- /home/op/nenjimhub/logs:/usr/local/software/nenjimhub/logs
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker stack deploy --compose-file /home/op/stack.yml stack --detach=true
|
||||
Reference in New Issue
Block a user