- redis搭建完成
- mysql搭建完成
-
1.命名空间prod创建并添加生产配置
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
<a name="ZdHFw"></a>
# 4.构建镜像并推送
```java
docker build -t ruoyi-xx .
#登录阿里云 提示输入密码
docker login --username=gaoxi72* registry.cn-hangzhou.aliyuncs.com
#推送镜像
docker tag ruoyi-gateway registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-gateway:latest
docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-gateway:latest
docker tag ruoyi-auth registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-auth:latest
docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-auth:latest
docker tag ruoyi-system registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-system:latest
docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-system:latest
5.构建微服务
6.构建前端镜像
docker build -t ruoyi-ui .
docker tag ruoyi-ui registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-ui:latest
docker push registry.cn-hangzhou.aliyuncs.com/aliyun_gx/ruoyi-ui:latest