-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor Dockerfiles to use multi-stage builds. Simplified builds by introducing Maven-based multi-stage builds, consolidating dependencies, and reducing image sizes. Updated entry points to ensure runtime efficiency and maintainability. Transitioned from `ADD` to `COPY` for better clarity and consistency.
- Loading branch information
Showing
2 changed files
with
46 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
FROM maven:3.9.4-amazoncorretto-21 AS build | ||
|
||
RUN yum update -y && yum install -y git && yum clean all | ||
|
||
WORKDIR /app | ||
|
||
COPY .m2 /root/.m2 | ||
|
||
COPY . . | ||
|
||
RUN mvn clean install -DskipTests | ||
|
||
FROM eclipse-temurin:21-alpine | ||
|
||
RUN apk add --no-cache --purge -uU bash && rm -rf /var/cache/apk/* /tmp/* | ||
|
||
RUN apk add --no-cache --purge -uU curl wget unzip gnupg openssl | ||
|
||
ADD create_key.sh . | ||
ADD SQLLoader-jar-with-dependencies.jar . | ||
ADD CSVLoader-jar-with-dependencies.jar . | ||
ADD CSVLoaderNewSearch-jar-with-dependencies.jar . | ||
ADD CSVDumper-jar-with-dependencies.jar . | ||
ADD VCFLocalLoader-jar-with-dependencies.jar . | ||
ADD VariantMetadataLoader-jar-with-dependencies.jar . | ||
ADD UnifiedVCFLocalLoader-jar-with-dependencies.jar . | ||
ADD MultialleleCounter-jar-with-dependencies.jar . | ||
ADD RekeyDataset-jar-with-dependencies.jar . | ||
ADD RemoveConceptFromMetadata-jar-with-dependencies.jar . | ||
ADD HideAnnotationCategoryValue-jar-with-dependencies.jar . | ||
ADD SequentialLoader-jar-with-dependencies.jar . | ||
|
||
ENTRYPOINT java $JAVA_OPTS -Xmx${HEAPSIZE:-2048}m -jar ${LOADER_NAME:-CSVLoader}-jar-with-dependencies.jar | ||
RUN apk add --no-cache --purge -uU bash curl wget unzip gnupg openssl && \ | ||
rm -rf /var/cache/apk/* /tmp/* | ||
|
||
WORKDIR /app | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/SQLLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/CSVLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/CSVLoaderNewSearch-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/CSVDumper-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/VCFLocalLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/VariantMetadataLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/UnifiedVCFLocalLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/MultialleleCounter-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/RekeyDataset-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/RemoveConceptFromMetadata-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/HideAnnotationCategoryValue-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/SequentialLoader-jar-with-dependencies.jar . | ||
COPY --from=build /app/docker/pic-sure-hpds-etl/create_key.sh . | ||
|
||
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -Xmx${HEAPSIZE:-2048}m -jar ${LOADER_NAME:-CSVLoader}-jar-with-dependencies.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
FROM maven:3.9.4-amazoncorretto-21 AS build | ||
|
||
RUN yum update -y && yum install -y git && yum clean all | ||
|
||
WORKDIR /app | ||
|
||
COPY .m2 /root/.m2 | ||
|
||
COPY . . | ||
|
||
RUN mvn clean install -DskipTests | ||
|
||
FROM amazoncorretto:21.0.1-alpine3.18 | ||
|
||
# Copy jar and access token from maven build | ||
ADD service-3.0.0-SNAPSHOT.jar /service.jar | ||
WORKDIR /app | ||
|
||
COPY --from=build /app/service/target/service-*-SNAPSHOT.jar /service.jar | ||
|
||
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /service.jar"] |