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

View File

@ -1,21 +1,25 @@
FROM eclipse-temurin:20-jdk as build
LABEL authors="A.C.Sukazyo Eyre"
FROM gradle:8.8-jdk21 AS build-base
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
RUN cd ./source \
&& ./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
COPY --from=build /build/build/libs/morny-coeur-docker-build.jar /app/morny-coeur.jar
ENTRYPOINT ["java", "-jar", "morny-coeur.jar"]
CMD ["-q", "-v"]