#基础镜像
FROM openjdk:17
#容器内根：/mnt
WORKDIR /mnt

#解决中文乱码问题
ENV LANG C.UTF-8
ENV LANGUAGE zh_CN.UTF-8
ENV LC_ALL C.UTF-8
ENV TZ Asia/Shanghai
#指定jvm运行参数（提供默认值-按照物理3G计算）
ENV JAVA_OPTS="-Xmx2048M -Xms2048M -Xmn768M -XX:MaxMetaspaceSize=256M -XX:MetaspaceSize=256M"
#指定环境(prod-生产,dev-开发)
ENV APP_ACTIVE="prod"
#指定配置项（预留）
ENV BOOT_CONFIG=""

#卷目录（关联日志配置log4j2-prod.xml，关联存储配置application-prod.yml）
VOLUME ["/mnt/app_logs","/mnt/app_storage","/mnt/app_jars"]

#暴露容器端口为8080
EXPOSE 8080

#容器启动时执行的命令
ENTRYPOINT nohup java -server ${JAVA_OPTS} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=${APP_ACTIVE} -jar /mnt/app_jars/shengtai.jar ${BOOT_CONFIG}








#docker inspect，这段信息别动
#[
#    {
#        "Id": "sha256:fd2772d5af9a3e60fe8b0a5c8ff16e5dc59ff5033705a9919ee59bf663aae5c7",
#        "RepoTags": [
#            "gift_app:v1"
#        ],
#        "RepoDigests": [],
#        "Parent": "",
#        "Comment": "buildkit.dockerfile.v0",
#        "Created": "2023-06-27T14:10:10.057222675+08:00",
#        "Container": "",
#        "ContainerConfig": {
#            "Hostname": "",
#            "Domainname": "",
#            "User": "",
#            "AttachStdin": false,
#            "AttachStdout": false,
#            "AttachStderr": false,
#            "Tty": false,
#            "OpenStdin": false,
#            "StdinOnce": false,
#            "Env": null,
#            "Cmd": null,
#            "Image": "",
#            "Volumes": null,
#            "WorkingDir": "",
#            "Entrypoint": null,
#            "OnBuild": null,
#            "Labels": null
#        },
#        "DockerVersion": "",
#        "Author": "qima",
#        "Config": {
#            "Hostname": "",
#            "Domainname": "",
#            "User": "",
#            "AttachStdin": false,
#            "AttachStdout": false,
#            "AttachStderr": false,
#            "ExposedPorts": {
#                "8080/tcp": {}
#            },
#            "Tty": false,
#            "OpenStdin": false,
#            "StdinOnce": false,
#            "Env": [
#                "PATH=/usr/java/openjdk-17/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
#                "JAVA_HOME=/usr/java/openjdk-17",
#                "LANG=C.UTF-8",
#                "JAVA_VERSION=17.0.2",
#                "LANGUAGE=zh_CN.UTF-8",
#                "LC_ALL=C.UTF-8",
#                "TZ=Asia/Shanghai",
#                "JAVA_OPTS=-Xmx2048M -Xms2048M -Xmn768M -XX:MaxMetaspaceSize=256M -XX:MetaspaceSize=256M",
#                "APP_ACTIVE=prod",
#                "BOOT_CONFIG="
#            ],
#            "Cmd": null,
#            "Image": "",
#            "Volumes": {
#                "[/mnt/app_logs,/mnt/app_storage]": {}
#            },
#            "WorkingDir": "/mnt",
#            "Entrypoint": [
#                "/bin/sh",
#                "-c",
#                "nohup java -server ${JAVA_OPTS} -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=${APP_ACTIVE} -jar /mnt/app.jar ${BOOT_CONFIG}"
#            ],
#            "OnBuild": null,
#            "Labels": null
#        },
#        "Architecture": "amd64",
#        "Os": "linux",
#        "Size": 514102948,
#        "VirtualSize": 514102948,
#        "GraphDriver": {
#            "Data": {
#                "LowerDir": "/var/lib/docker/overlay2/6zo7j8n4x2pul51m4z3e3lpj8/diff:/var/lib/docker/overlay2/0c9b8ac9bc6dbb5278f4433a17310534db404f62fdbe226220a95b92577957af/diff:/var/lib/docker/overlay2/bb4e03b128b60431dbece15b0ffd0e072b7decea3d3fc7b6cea32d59b49faf26/diff:/var/lib/docker/overlay2/fc6a5268bb7a5255205b14f2f81edebb6e292e345d6eaeef365698a5188d4b41/diff",
#                "MergedDir": "/var/lib/docker/overlay2/lc0l37hs4kcfol4425lorsvo1/merged",
#                "UpperDir": "/var/lib/docker/overlay2/lc0l37hs4kcfol4425lorsvo1/diff",
#                "WorkDir": "/var/lib/docker/overlay2/lc0l37hs4kcfol4425lorsvo1/work"
#            },
#            "Name": "overlay2"
#        },
#        "RootFS": {
#            "Type": "layers",
#            "Layers": [
#                "sha256:c8dd97366670ed499701572c321fb87ef4f9287308536563a8f1e3fd39ff2166",
#                "sha256:27ee19dc88f2661d3e42161a9b0b5f4c59089269ee71c9f212c71139ea9edf52",
#                "sha256:dc9fa3d8b576eada8a4f97ca296d0db470ea7342d544e7e2f3c42715d20c2798",
#                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
#                "sha256:441e155b4ffda31c75b6dedcdda7859a04c3096346fed4ed4ca7552cbbce7d94"
#            ]
#        },
#        "Metadata": {
#            "LastTagTime": "2023-06-27T14:10:10.250446336+08:00"
#        }
#    }
#]