-
Notifications
You must be signed in to change notification settings - Fork 132
/
Dockerfile
39 lines (27 loc) · 959 Bytes
/
Dockerfile
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
FROM openjdk:8-jdk-alpine
MAINTAINER [email protected]
ADD . .
RUN pwd
RUN ls -l
ENV MAVEN_VERSION=3.6.3
# install maven ${MAVEN_VERSION}
RUN mkdir -p /usr/local/maven
WORKDIR /usr/local/maven
RUN wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
RUN tar -zxvf apache-maven-${MAVEN_VERSION}-bin.tar.gz && \
rm -fr apache-maven-${MAVEN_VERSION}-bin.tar.gz
#对外暴漏的端口号
EXPOSE 8086
WORKDIR /
RUN /usr/local/maven/apache-maven-${MAVEN_VERSION}/bin/mvn clean package
#将本地项目jar包拷贝到Docker容器中的位置
RUN cp ./target/helloblog-v1.1.0.jar ./
RUN rm -rf target
RUN rm -rf repository
RUN rm -rf pom.xml
RUN rm -rf Dockerfile
#加入时区
RUN apk add --no-cache tzdata
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#开机启动
ENTRYPOINT ["java","-jar","/helloblog-v1.1.0.jar"]