SpringCloud Dockerfile

作者: Ju4t

dockerfile

FROM java:8-jre
MAINTAINER xiaobing <Ju4t@qq.com>

VOLUME /tmp
ADD web-0.0.1-SNAPSHOT.jar app.jar
RUN bash -c 'touch /app.jar'
ENV APP_OPTS=""
ENTRYPOINT ["sh","-c","java -Djava.security.egd=file:/dev/./urandom -jar /app.jar $APP_OPTS"]

EXPOSE 8080

k8s deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
  labels:
    app: web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: ju4t/xxxx # 此处替换为build的images
          ports:
            - containerPort: 8080
          env:
            - name: APP_OPTS
              value: "
                     --eureka.instance.prefer-ip-address=true
                     --eureka.client.serviceUrl.defaultZone=http://eureka-0:8000/eureka/,http://eureka-1:8000/eureka/,http://eureka-2:8000/eureka/"

https://github.com/Ju4t/spring-cloud