-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
82 lines (69 loc) · 2.83 KB
/
Copy pathDockerfile
File metadata and controls
82 lines (69 loc) · 2.83 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Build stage
FROM gradle:8.5-jdk17 as builder
WORKDIR /app
# Copy gradle configuration files FIRST (for better caching and to catch issues early)
COPY gradle/ gradle/
COPY build.gradle.kts .
COPY settings.gradle.kts .
COPY gradle.properties .
COPY gradlew .
COPY gradlew.bat .
# Copy submodule build files before dependency download so Gradle can resolve all projects
COPY core/build.gradle.kts core/build.gradle.kts
COPY weatherify/build.gradle.kts weatherify/build.gradle.kts
COPY syncling/build.gradle.kts syncling/build.gradle.kts
# Make gradlew executable
RUN chmod +x gradlew
# Predownload dependencies to improve build performance and catch dependency issues early
RUN ./gradlew --version && \
./gradlew dependencies --no-daemon || echo "Warning: Dependency check had issues but continuing..."
# Copy all source code (this layer changes frequently)
COPY src/ src/
COPY core/src/ core/src/
COPY weatherify/src/ weatherify/src/
COPY syncling/src/ syncling/src/
# Build the application using the gradle wrapper
RUN echo "================================" && \
echo "Starting Gradle build..." && \
echo "================================" && \
./gradlew clean build --no-daemon -x test || (echo "Build failed!"; exit 1) && \
echo "================================" && \
echo "Build completed. Checking for JAR file..." && \
echo "================================" && \
if [ -f /app/build/libs/weatherify-api-all.jar ]; then \
echo "✓ SUCCESS: Found weatherify-api-all.jar"; \
ls -lh /app/build/libs/weatherify-api-all.jar; \
jar tf /app/build/libs/weatherify-api-all.jar > /dev/null && echo "✓ JAR integrity verified"; \
else \
echo "✗ FAILED: weatherify-api-all.jar not found!"; \
echo "Contents of /app/build:"; \
find /app/build -name "*.jar" -type f; \
echo "Full directory listing:"; \
ls -lah /app/build/libs/ 2>/dev/null || echo "build/libs directory does not exist"; \
exit 1; \
fi
# Runtime stage
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
# Copy the built fat JAR from builder
COPY --from=builder /app/build/libs/weatherify-api-all.jar ./app.jar
# Set environment variables
ENV DB_NAME="weatherify-app-db"
ENV WEATHER_URL="https://api.openweathermap.org/data/3.0/onecall"
ENV AIR_POLLUTION_URL="https://api.openweathermap.org/data/2.5/air_pollution"
ENV JWT_EXPIRATION="3600000"
ENV JWT_AUDIENCE="jwt-audience"
ENV JWT_ISSUER="jwt-issuer"
ENV JWT_REALM="jwt-realm"
ENV GA_ENABLED="true"
ENV GA_TRACKING_ID="G-EBVRVNN6JF"
ENV GA_MEASUREMENT_ID="G-LWRPRSSDRY"
ENV GA_API_SECRET=""
ENV GRACE_PERIOD_HOURS="72"
ENV SUBSCRIPTION_EXPIRY_CHECK_INTERVAL_MINUTES="720"
ENV FROM_NAME="Androidplay Inc."
ENV FROM_EMAIL="ankush@androidplay.in"
ENV REFUND_FEATURE_ENABLED="true"
ENV INSTANT_REFUND_ENABLED="true"
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]