-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 827 Bytes
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Multi-stage build for Weather App Java
# Build stage
FROM eclipse-temurin:21-jdk AS build
WORKDIR /app
# Copy gradle files first for better layer caching
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
# Make gradlew executable
RUN chmod +x ./gradlew
# Download dependencies (will be cached if no changes)
RUN ./gradlew dependencies --no-daemon
# Copy source code
COPY src src
# Build the application
RUN ./gradlew build --no-daemon -x test
# Runtime stage
FROM eclipse-temurin:21-jre
WORKDIR /app
# Copy the built artifact from the build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Environment variables
ENV AI_API_KEY=""
ENV GOOGLE_GEMINI_MODEL="gemini-1.5-flash"
# Expose the application port
EXPOSE 8080
# Run the application
ENTRYPOINT ["java", "-jar", "/app/app.jar"]