Dockerfile:
FROM openjdk:8u252-jdk
ENV JHIPSTER_SLEEP=0 \
JAVA_OPTS="" \
LOGFILE="" \
ACTIVE=""
EXPOSE 7777
WORKDIR /data/app
ADD entrypoint.sh entrypoint.sh
ADD ./target/classes/logback-boot-prod.xml logback-boot-prod.xml
RUN mkdir -p /data/logs/log_path
RUN chmod 755 entrypoint.sh
ADD ./target/xxxx-*-SNAPSHOT.jar ./xxxx.jar
ENTRYPOINT ["./entrypoint.sh"]
##########################################################################################
#!/bin/sh
echo "The application will start in ${JHIPSTER_SLEEP}s..." && sleep ${JHIPSTER_SLEEP}
exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "/data/app/xxx.jar" --logging.config=/data/app/logback-boot-${LOGFILE}.xml --spring.profiles.active=${ACTIVE} "$@"
docker-compose.yaml:
version: '3.7'
services:
xxxxxxxxxxxxx:
image: xxxxxxxxxxxxx
container_name: xxxxxxxxxxxxx
hostname: xxxxxxxxxxxxx
restart: always
network_mode: host
environment:
- JAVA_OPTS=-Xms256m -Xmx256m
- TZ=Asia/Shanghai
- ACTIVE=pre
- LOGFILE=test
volumes:
- /data/logs/xxx:/data/logs/xxx
ports:
- "7777:7777"