-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Dockerfile and local docker compose example (#4)
Signed-off-by: ablandel <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Build inspired by https://zwbetz.com/why-is-my-gradle-build-in-docker-so-slow/ article. | ||
FROM gradle:8.7.0-jdk21 AS build | ||
WORKDIR /home/gradle/src | ||
# Only copy dependency-related files. | ||
COPY build.gradle.kts gradle.properties settings.gradle.kts ./ | ||
# Only download dependencies. The dependencies will be cached for next builds. | ||
# Eat the expected build failure since no source code has been copied yet. | ||
RUN gradle clean build --no-daemon > /dev/null 2>&1 || true | ||
# Copy project sources. | ||
COPY ./src ./src | ||
# Do the real build without the unit tests (Docker would be required for DAOs tests). | ||
RUN gradle bootJar -x test --no-daemon | ||
|
||
FROM eclipse-temurin:21-jre | ||
WORKDIR /app | ||
EXPOSE 8080 | ||
COPY --from=build /home/gradle/src/build/libs/another-kaomoji-*.jar another-kaomoji.jar | ||
ENTRYPOINT ["java", "-jar", "/app/another-kaomoji.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,6 @@ | ||
#Tue Apr 02 18:24:22 CEST 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
services: | ||
postgresql: | ||
container_name: another-kaomoji-db | ||
image: postgres:16-alpine | ||
restart: always | ||
environment: | ||
POSTGRES_PASSWORD: postgres | ||
ports: | ||
- "5432:5432" | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
another-kaomoji: | ||
container_name: another-kaomoji | ||
image: another-kaomoji:local | ||
restart: always | ||
depends_on: | ||
- postgresql | ||
environment: | ||
spring.datasource.url: jdbc:postgresql://postgresql:5432/postgres | ||
ports: | ||
- "8080:8080" |