From 123b01d1d0e9577b478b0ec1bd88370d19798b9c Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 29 Apr 2024 06:45:30 +0100 Subject: [PATCH] pls work --- Dockerfile | 4 ---- .../java/cc/fascinated/piaservers/common/GitUtils.java | 9 +++++++++ .../java/cc/fascinated/piaservers/pia/PiaManager.java | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0060843..c7b0d5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,9 +25,5 @@ WORKDIR /home/container # Copy the built jar file from the builder stage COPY --from=builder /home/container/target/PIA-Servers.jar . -# Make port 80 available to the world outside this container -EXPOSE 80 -ENV PORT=80 - # Run the jar file CMD java -jar PIA-Servers.jar -Djava.awt.headless=true \ No newline at end of file diff --git a/src/main/java/cc/fascinated/piaservers/common/GitUtils.java b/src/main/java/cc/fascinated/piaservers/common/GitUtils.java index cebb9c4..9662a6c 100644 --- a/src/main/java/cc/fascinated/piaservers/common/GitUtils.java +++ b/src/main/java/cc/fascinated/piaservers/common/GitUtils.java @@ -22,6 +22,15 @@ public class GitUtils { runCommand("git", "push", "https://pia-servers-ci:%s@git.fascinated.cc/Fascinated/PIA-Servers".formatted(System.getenv("AUTH_TOKEN"))); } + /** + * Clone the repository + */ + public static void cloneRepo() { + if (System.getenv("ENVIRONMENT").equals("production")) { + runCommand("git", "clone", "https://git.fascinated.cc/Fascinated/PIA-Servers.git"); + } + } + /** * Run a system command * diff --git a/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java b/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java index 87b51be..3b9da73 100644 --- a/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java +++ b/src/main/java/cc/fascinated/piaservers/pia/PiaManager.java @@ -41,6 +41,8 @@ public class PiaManager { SERVERS = new ArrayList<>(); } + GitUtils.cloneRepo(); // Clone the repository + new Timer().scheduleAtFixedRate(new TimerTask() { @Override public void run() {