-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile_whole
64 lines (50 loc) · 1.67 KB
/
Dockerfile_whole
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 拉取基础镜像
FROM alpine:latest
# 维护人
# MAINTAINER 951645267@qq.com
LABEL org.opencontainers.image.authors="951645267@qq.com"
ENV SERVICE=lx-doc
ENV MYSQL_DATABASE=lx_doc
ENV MYSQL_ROOT_PASSWORD=lx_doc_test
USER root
EXPOSE 9222
EXPOSE 80
EXPOSE 3306
# 安装openjdk11
ENV JAVA_HOME="/usr/lib/jvm/default-jvm/"
RUN apk add openjdk11
ENV PATH=$PATH:${JAVA_HOME}/bin
# 处理时区
RUN apk add tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
# 安装 nginx
RUN apk add --no-cache nginx
# nginx 日志目录
RUN mkdir -p /var/log/nginx/ \
# web 静态资源存放目录,这个目录最好映射到宿主机
&& mkdir -p /usr/web/html/ \
&& mkdir -p /usr/nginx/config/ \
&& mkdir -p /usr/config/${SERVICE}/ \
&& mkdir -p /usr/app/${SERVICE}/ \
&& mkdir -p /usr/logs/${SERVICE}/ \
&& mkdir -p /usr/attament/${SERVICE}/
# 安装 mysql
RUN apk add --update mysql mysql-client \
&& rm -f /var/cache/apk/*
COPY lx-doc.zip /usr/web/html/
RUN unzip -q -d /usr/web/html/ /usr/web/html/lx-doc.zip \
&& rm -rf /usr/web/html/lx-doc.zip
COPY nginx.conf /usr/nginx/config/
COPY my.cnf /etc/mysql/my.cnf
COPY mysql_init_start.sh /usr/app/${SERVICE}/
COPY doc.sql /usr/app/${SERVICE}/
COPY run_in_docker_whole.sh /usr/app/${SERVICE}/
COPY application-prod.yml /usr/config/${SERVICE}/
COPY lx-core/target/lx-doc.jar /usr/app/${SERVICE}/
# 如果是在windows下进行 docker 构建的话,要去掉 \r\n 换行符的\r
RUN sed -i 's/\r$//' /usr/app/${SERVICE}/*.sh
VOLUME /usr/app/mysql
WORKDIR /usr/app/${SERVICE}/
ENTRYPOINT ["sh", "run_in_docker_whole.sh", "initStart"]