changed Dockerfile

This commit is contained in:
A.C.Sukazyo Eyre 2024-11-03 15:11:29 +08:00
parent 2611ad702f
commit 5f08408ccf
Signed by: Eyre_S
GPG Key ID: EFB47D98FE082FAD
2 changed files with 40 additions and 30 deletions

View File

@ -1,17 +1,23 @@
# Ignore everything
*
# IDE # Allow files and directories
.idea/ !/.git
.vscode/ !/src
.gradle/ !/.editorconfig
.settings/ !/.gitattributes
!/.gitignore
!/build.gradle
!/gradle.properties
!/gradlew
!/gradlew.bat
!/morny-github-social-preview-card@0.75x.png
!/README.md
!/settings.gradle
#build # Ignore unnecessary files inside allowed directories
/build/ # This should go after the allowed directories
/bin/ **/*~
.metals/ **/*.log
.bloop/ **/.DS_Store
.project **/Thumbs.db
lcoal.properties
# debug dir
/run/

View File

@ -1,21 +1,25 @@
FROM eclipse-temurin:20-jdk as build FROM gradle:8.8-jdk21 AS build-base
LABEL authors="A.C.Sukazyo Eyre"
WORKDIR /build
COPY ./build.gradle ./settings.gradle ./gradle.properties /build/
RUN gradle buildEnvironment
RUN gradle dependencies
FROM build-base AS build
WORKDIR /build
COPY . /build/
RUN gradle shadowJar -PdockerBuild
FROM eclipse-temurin:20-jre AS app
COPY . /app/source/
WORKDIR /app WORKDIR /app
RUN cd ./source \ COPY --from=build /build/build/libs/morny-coeur-docker-build.jar /app/morny-coeur.jar
&& ./gradlew shadowJar -PdockerBuild \
&& cd .. \
&& cp ./source/build/libs/morny-coeur-docker-build.jar ./morny-coeur.jar
#&& rm -r ./source \
#&& rm -r /root/.gradle \
FROM eclipse-temurin:20-jre
COPY --from=build /app/morny-coeur.jar /app/morny-coeur.jar
WORKDIR /app
ENTRYPOINT ["java", "-jar", "morny-coeur.jar"] ENTRYPOINT ["java", "-jar", "morny-coeur.jar"]
CMD ["-q", "-v"] CMD ["-q", "-v"]