Skip to content

Commit a81cb67

Browse files
update docker file
1 parent b715373 commit a81cb67

File tree

1 file changed

+12
-35
lines changed

1 file changed

+12
-35
lines changed

Examples.GridJs/Dockerfile

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,30 @@
1-
2-
3-
# FROM mcr.microsoft.com/java/openjdk:11 AS build
4-
FROM eclipse/ubuntu_jdk8
5-
6-
# 设置工作目录
1+
FROM maven:3.8.6-amazoncorretto-17 AS build
2+
# 设置工作目录
73
WORKDIR /usr/src/app
84

9-
10-
11-
12-
# 将本地的 Maven 设置文件和环境变量设置文件复制到容器中
13-
COPY mvnw .
5+
# 将本地的 Maven 设置文件和环境变量设置文件复制到容器中
146
COPY .mvn .mvn
157
COPY pom.xml .
168
COPY src src
17-
18-
# 使用 Maven 构建应用(假设你使用的是 Maven)
19-
RUN ./mvnw package -DskipTests
20-
21-
22-
23-
24-
25-
# Set the user
26-
USER root
27-
28-
RUN ls -l *
29-
30-
# 将构建的 jar 文件复制到新的容器中
31-
COPY target/*.jar /app/app.jar
32-
33-
# 删除不再需要的源码和 Maven 缓存,减少镜像体积
34-
RUN rm -rf target && rm -rf .mvn && rm -rf src
35-
36-
37-
38-
399

10+
RUN ls -l *
11+
# 使用 Maven 构建应用
12+
RUN mvn package -DskipTests
4013

14+
FROM eclipse/ubuntu_jdk8
15+
WORKDIR /app
16+
# 将构建的 jar 文件复制到新的容器中
17+
COPY --from=build /usr/src/app/target/*.jar /app/app.jar
4118

4219

4320
# web port
4421
EXPOSE 8080
45-
# Install Fonts because the SDK image contains very few fonts. The command copies font files from local to docker image. Make sure you have a local “fonts” directory that contains all the fonts you need to install. In this example, the local “fonts” directory is put in the same directory as the Dockerfile.
22+
# Install Fonts because the SDK image contains very few fonts. The command copies font files from local to docker image. Make sure you have a local “fonts” directory that contains all the fonts you need to install. In this example, the local “fonts” directory is put in the same directory as the Dockerfile.
4623
# COPY fonts/* /usr/share/fonts/
4724
RUN mkdir -p /app/wb
4825
RUN mkdir -p /app/grid_cache/streamcache
4926
RUN mkdir -p /app/upload
5027
COPY wb/*.xlsx /app/wb/
5128
# RUN ls -l /app/
52-
# 启动应用
29+
# 启动应用
5330
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app/app.jar"]

0 commit comments

Comments
 (0)