Dockerfile
FROM centos:7.5.1804
MAINTAINER hkaih "1240642692@qq.com"
# set environment
ENV BASE_DIR="/home/workspace" \
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" \
JAVA="/usr/lib/jvm/java-1.8.0-openjdk/bin/java" \
JVM_XMS="2g" \
JVM_XMX="2g" \
JVM_XMN="1g" \
JVM_MS="128m" \
JVM_MMS="320m" \
TIME_ZONE="Asia/Shanghai"
RUN mkdir -p /$BASE_DIR/webapp
RUN mkdir -p /$BASE_DIR/logs
WORKDIR /$BASE_DIR
RUN set -x \
&& yum update -y \
&& yum install -y java-1.8.0-openjdk vim
COPY black-1.0.2.jar /$BASE_DIR/webapp/app.jar
RUN yum autoremove -y wget \
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone \
&& yum clean all
VOLUME /tmp
VOLUME /$BASE_DIR/logs
EXPOSE 8080
EXPOSE 8719
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom",\
"-Duser.timezone=GMT+08","-jar",\
"/home/workspace/webapp/app.jar",\
"spring.profiles.active=$SPRING_PROFILES_ACTIVE",\
"spring.cloud.nacos.config.server-addr=$SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR",\
"spring.cloud.nacos.discovery.port=$SPRING_CLOUD_NACOS_DISCOVERY_PORT",\
"spring.cloud.nacos.discovery.ip=$SPRING_CLOUD_NACOS_DISCOVERY_IP",\
"spring.cloud.sentinel.transport.port=$SPRING_CLOUD_SENTINEL_TRANSPORT_PORT",\
"spring.cloud.sentinel.transport.client-ip=$SPRING_CLOUD_NACOS_DISCOVERY_IP"]
建项目文件夹
mkdir bank
###上传
rz
打镜像
docker build -t xxxxx:1.0.1 .
登录
docker login xxxxx(地址)
推镜像
docker push xxx:1.0.1