如何将多个 jar 文件添加到 docker 镜像 jar 文件中

时间:2021-07-26 03:59:14

标签: java docker dockerfile

# Compile our java files in this container
FROM openjdk:17-slim AS builder
COPY src /usr/src/cs6310/src
COPY lib /usr/lib
WORKDIR /usr/src/cs6310
RUN find . -name "*.java" | xargs javac -cp "../../lib/java-jwt-3.9.0.jar" -d ./target
RUN jar cfe streaming_wars.jar Main -C ./target/ .

# Copy the jar and test scenarios into our final image
FROM openjdk:17-slim
WORKDIR /usr/src/cs6310
COPY test_scenarios ./
COPY ./bin/* ./
COPY --from=builder /usr/src/cs6310/streaming_wars.jar ./streaming_wars.jar
CMD ["java", "-jar", "streaming_wars.jar", "commands_00.txt"]

我目前有以下 docker 文件,但只有一个 jar 文件被复制。如何修改文件以便将 lib 文件夹下的所有 jar 文件复制过来

0 个答案:

没有答案