• redis搭建完成
  • mysql搭建完成
  • [ ] nacos搭建完成

    1.命名空间prod创建并添加生产配置

    image.png

    2.修改配置中的中间件地址

  • [ ] redis域名: ruoyi-redis-j513.hello-world

  • mysql域名:ruoyi-mysql-0m06.hello-world

    3.通用Dockerfile

    ```java FROM openjdk:8-jdk LABEL maintainer=gaoxi

ENV PARAMS=”—server.port=8080 —spring.profiles.active=prod —spring.cloud.nacos.discovery.server-addr=ruoyi-nacos.hello-world:8848 —spring.cloud.nacos.config.server-addr=ruoyi-nacos.hello-world:8848 —spring.cloud.nacos.config.namespace=prod —spring.cloud.nacos.config.file-extension=yml” RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo ‘Asia/Shanghai’ >/etc/timezone

COPY target/*.jar /app.jar EXPOSE 8080

# ENTRYPOINT [“/bin/sh”,”-c”,”java -Dfile.encoding=utf8 -Djava.security.egd=file:/dev/./urandom -jar app.jar ${PARAMS}”]

java -Dfile.encoding=utf8 -Djava.security.egd=file:/dev/./urandom -Dserver.port=8080 -Dspring.profiles.active=prod -Dspring.cloud.nacos.discovery.server-addr=10.233.116.223:8848 -Dspring.cloud.nacos.config.server-addr=10.233.116.223:8848 -Dspring.cloud.nacos.config.namespace=a3087769-20f5-4f72-94dc-0cadf1007eb6 -Dspring.cloud.nacos.config.file-extension=yml -jar app.jar

  1. <a name="ZdHFw"></a>
  2. # 4.构建镜像并推送
  3. ```java
  4. docker build -t ruoyi-xx .
  5. #登录阿里云 提示输入密码
  6. docker login --username=gaoxi72* registry.cn-hangzhou.aliyuncs.com
  7. #推送镜像
  8. docker tag ruoyi-gateway registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-gateway:latest
  9. docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-gateway:latest
  10. docker tag ruoyi-auth registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-auth:latest
  11. docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-auth:latest
  12. docker tag ruoyi-system registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-system:latest
  13. docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-system:latest

5.构建微服务

image.png

6.构建前端镜像

image.png
image.png

  1. docker build -t ruoyi-ui .
  2. docker tag ruoyi-ui registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-ui:latest
  3. docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-ui:latest