FROM java:8
ADD ./target/demo.jar /app/
RUN echo "Asia/Shanghai" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
EXPOSE 8080
ENTRYPOINT exec java $JAVA_OPTS -jar /app/demo.jar
version: '3.5'
services:
demo:
image: demo
build: ./demo
healthcheck:
test: ["CMD-SHELL", "curl -sS 127.0.0.1:8080 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
deploy:
mode: replicated
replicas: 4
endpoint_mode: dnsrr
update_config:
parallelism: 1
failure_action: pause
delay: 30s
order: start-first
networks:
- public
- default
environment:
SPRING_PROFILES_ACTIVE: test
JAVA_OPTS: "-Xmx2048m"
restart: always
logging:
options:
max-size: "10m"
max-file: "10"