谷粒商城sentinel打成镜像
sentinel之前也简单的写过博客:https://www.cnblogs.com/dalianpai/p/12283155.html
项目中是本地启动的,我直接打成镜像,这样用起来方便点,具体如下:
[root@cicd sentinel]# pwd
/wgr/sentinel
[root@cicd sentinel]# ll
total 20640
-rw-r--r-- 1 root root 250 Aug 19 13:20 Dockerfile
-rw-r--r-- 1 root root 21127853 Aug 19 12:32 sentinel-dashboard-1.6.3.jar
[root@cicd sentinel]# cat Dockerfile
FROM java:8
VOLUME /tmp
ADD sentinel-dashboard-1.6.3.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 8889
ENTRYPOINT ["java","-Dserver.port=8889","-Dcsp.sentinel.dashboard.server=localhost:8889","-Dproject.name=sentinel-dashboard","-jar","/app.jar"]
[root@cicd sentinel]#
[root@cicd sentinel]# docker build -f Dockerfile -t sentinel:v1.6.3 .
Sending build context to Docker daemon 21.13MB
Step 1/6 : FROM java:8
---> d23bdf5b1b1b
Step 2/6 : VOLUME /tmp
---> Using cache
---> 548bac3b1023
Step 3/6 : ADD sentinel-dashboard-1.6.3.jar app.jar
---> Using cache
---> 7c923ddf190d
Step 4/6 : RUN bash -c 'touch /app.jar'
---> Using cache
---> dd34df514bc2
Step 5/6 : EXPOSE 8889
---> Using cache
---> 666b71adce7b
Step 6/6 : ENTRYPOINT ["java","-Dserver.port=8889","-Dcsp.sentinel.dashboard.server=localhost:8889","-Dproject.name=sentinel-dashboard","-jar","/app.jar"]
---> Running in 55433508e9d6
Removing intermediate container 55433508e9d6
---> f9e95128225c
Successfully built f9e95128225c
Successfully tagged sentinel:v1.6.3
root@cicd sentinel]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e98ebbf0082f f9e95128225c "java -Dserver.port=…" 3 minutes ago Up 3 minutes 0.0.0.0:8889->8889/tcp sharp_shockley
[root@cicd sentinel]# docker update --restart=always e98ebbf0082f
e98ebbf0082f