docker Dockerfile

Last updated on November 22, 2024 pm

🧙 Questions

dockerfile文件语法

☄️ Ideas


# 基础镜像
FROM adoptopenjdk:8-jdk-hotspot

# 维护者信息
MAINTAINER  ispong ispong@outlook.com

# 容器中运行命令
RUN curl -O https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
RUN tar -zxvf apache-maven-3.6.3-bin.tar.gz && mv apache-maven-3.6.3 /opt/powerjob-maven && rm -rf apache-maven-3.6.3-bin.tar.gz
RUN rm -rf /opt/powerjob-maven/conf/settings.xml

# 拷贝主机文件到容器中
COPY settings.xml /opt/powerjob-maven/conf/settings.xml

# 声明运行环境变量
ENV M2_HOME=/opt/powerjob-maven

# 设置时区
ENV TZ=Asia/Shanghai

# 字符集
ENV LANG en_US.UTF-8
# 默认ENV LANG C.UTF-8
# ENV LANG zh_CN.UTF-8

# 设置环境变量
ENV APP_NAME=powerjob-server
ENV PARAMS=""
ENV JVMOPTIONS="" 

# 将主机文件拷贝到容器
COPY powerjob-server.jar /powerjob-server.jar

# 暴露容器端口
EXPOSE 7700 10086 10010

# 创建 docker 文件目录(盲猜这是用户目录)
RUN mkdir -p /root/powerjob-server

# 挂载数据卷,将文件直接输出到宿主机(注意,此处挂载的是匿名卷,即在宿主机位置随机)
VOLUME /root/powerjob

# 启动应用
ENTRYPOINT ["sh","-c","java $JVMOPTIONS -jar /powerjob-server.jar $PARAMS"]

docker Dockerfile
https://ispong.isxcode.com/kubernetes/docker/docker Dockerfile/
Author
ispong
Posted on
April 23, 2021
Licensed under