我是一家拥有大约200德国马克的附属公司的项目,我是为了避免由于我有限的带宽而无用上载。
当我推一下我的Dockerfile(一刻,我就把它放在一起时),我总是有大约200MB上下载,即使我用斜线触及om。
FROM maven:3.6.0-jdk-8-slim
WORKDIR /app
ADD pom.xml /app
RUN mvn verify clean --fail-never
COPY ./src /app/src
RUN mvn package
ENV CONFIG_FOLDER=/app/config
ENV DATA_FOLDER=/app/data
ENV GOLDENS_FOLDER=/app/goldens
ENV DEBUG_FOLDER=/app/debug
WORKDIR target
CMD ["java","-jar","-Dlogs=/app/logs", "myProject.jar"]
这份Dockerfile公司应当配备200德国马克,包括所有附属公司,因此每当一次就会出现200德国马克。 想要实现的是,在包装阶段建造一个有所有附属和“星号”的电离层,以便不将附属公司列入联合财产调查组,而是在某个目录内搜寻。
I was wondering to build a script that executes mvn dependency:copy-dependencies
before the building process and then copying the directory to the container; then building a "non-fat"JAR that has all those dependencies only linked and not actually copied into it.
这是可能的吗?
EDIT:
I discovered that the Maven Local Repository of the container is located under /root/.m2
. So I ended making a very simple script like this:
mvn verify -clean --fail-never
mv ~/.m2 ~/git/myProjectRepo/.m2
sudo docker build -t myName/myProject:"$1"
编辑
# Use an official Python runtime as a parent image
FROM maven:3.6.0-jdk-8-slim
# Copy my Mavne Local Repository into the container thus creating a new layer
COPY ./.m2 /root/.m2
# Set the working directory to /app
WORKDIR /app
# Copy the pom.xml
ADD pom.xml /app
# Resolve and Download all dependencies: this will be done only if the pom.xml has any changes
RUN mvn verify clean --fail-never
# Copy source code and configs
COPY ./src /app/src
# create a ThinJAR
RUN mvn package
# Run the jar
...
在施工过程之后,i表示/root/m2
(a) 启动联合调查,以便:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Priority
at myProject.ThreeMeans.calculate(ThreeMeans.java:17)
at myProject.ClusteringStartup.main(ClusteringStartup.java:7)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
或许可以通过<编码>java -jar<>/code>操作。