########################################################
#   docker build -t ruoyi-gateway:1.0 .
########################################################

FROM openjdk:8

MAINTAINER learshaw@gmail.com

# 创建目录
RUN mkdir -p /opt/ems/ruoyi-gateway
WORKDIR /opt/ems/ruoyi-gateway

# 添加
COPY ruoyi-gateway.jar /opt/ems/ruoyi-gateway/

# 声明端口
EXPOSE 9100

# 环境变量
ENV GRPC_PORT_OFFSET=1000
ENV NACOS_SERVER=0.0.0.0:8848
ENV NACOS_NAMESPACE=ems
ENV SPRING_PROFILES_ACTIVE=prod

# 启动网关服务
ENTRYPOINT java -Dnacos.server.grpc.port.offset=$GRPC_PORT_OFFSET -jar ruoyi-gateway.jar \
  --spring.profiles.active=$SPRING_PROFILES_ACTIVE \
  --spring.cloud.nacos.discovery.server-addr=$NACOS_SERVER \
  --spring.cloud.nacos.discovery.namespace=$NACOS_NAMESPACE \
  --spring.cloud.nacos.config.server-addr=$NACOS_SERVER \
  --spring.cloud.nacos.config.namespace=$NACOS_NAMESPACE