Dockerfile
FROM openjdk:8-jdk-alpine
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
WORKDIR /sa-token
COPY ./sa-token-demo-0.0.1-SNAPSHOT.jar /sa-token/app.jar
VOLUME /sa-token/logs
CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/sa-token/app.jar"]
docker-compose.yml
version: "3"
services:
sa-token:
build:
context: .
dockerfile: dockerfile
container_name: sa-token
volumes:
- my_logs:/sa-token/logs
ports:
- "8081:8081"
restart: always
volumes:
my_logs: