eleeter commited on
Commit
b22422d
·
verified ·
1 Parent(s): d08f75d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -13
Dockerfile CHANGED
@@ -1,29 +1,27 @@
1
  # STEP 1: Build stage
2
  FROM gradle:8-jdk17 AS build
3
  WORKDIR /home/gradle/src
4
-
5
- # Copy all project files
6
  COPY --chown=gradle:gradle . .
7
-
8
- # Run the 'jar' task defined in your build.gradle
9
  RUN gradle jar --no-daemon
10
 
11
  # STEP 2: Runtime stage
12
  FROM eclipse-temurin:17-jre
13
  WORKDIR /app
14
 
15
- # 1. Copy the JAR from the build stage
16
  COPY --from=build /home/gradle/src/build/libs/*.jar app.jar
17
-
18
- # 2. Copy your JSON configuration files
19
  COPY *.json .
20
 
21
- # 3. FIX DNS: Force the container to use Google's DNS
22
- RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf
23
-
24
- # 4. Set permissions
25
  RUN chmod -R 777 /app
26
  EXPOSE 8000
27
 
28
- # 5. Start Java with DNS caching disabled to prevent "UnknownHost" sticking
29
- ENTRYPOINT ["java", "-Dsun.net.inetaddr.ttl=0", "-Dsun.net.inetaddr.negative.ttl=0", "-jar", "app.jar"]
 
 
 
 
 
 
 
1
  # STEP 1: Build stage
2
  FROM gradle:8-jdk17 AS build
3
  WORKDIR /home/gradle/src
 
 
4
  COPY --chown=gradle:gradle . .
5
+ # Using the standard jar task from your build.gradle
 
6
  RUN gradle jar --no-daemon
7
 
8
  # STEP 2: Runtime stage
9
  FROM eclipse-temurin:17-jre
10
  WORKDIR /app
11
 
12
+ # 1. Copy files from build
13
  COPY --from=build /home/gradle/src/build/libs/*.jar app.jar
 
 
14
  COPY *.json .
15
 
16
+ # 2. Permissions
 
 
 
17
  RUN chmod -R 777 /app
18
  EXPOSE 8000
19
 
20
+ # 3. START COMMAND (The DNS Fix)
21
+ # We tell the JVM to use Google's DNS directly and never cache failures.
22
+ ENTRYPOINT ["java", \
23
+ "-Dsun.net.spi.nameserver.nameservers=8.8.8.8", \
24
+ "-Dsun.net.spi.nameserver.provider.1=dns", \
25
+ "-Dsun.net.inetaddr.ttl=0", \
26
+ "-Dsun.net.inetaddr.negative.ttl=0", \
27
+ "-jar", "app.jar"]