-
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.
Automatically runs chartwells_query script when container is started.
- Loading branch information
1 parent
e764635
commit 8d09d8b
Showing
5 changed files
with
41 additions
and
13 deletions.
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 |
---|---|---|
@@ -1,25 +1,28 @@ | ||
FROM gradle:7.6.0-jdk17 AS build | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy the Gradle configuration and source code | ||
COPY build.gradle settings.gradle /app/ | ||
COPY src /app/src | ||
|
||
# Build the application | ||
RUN gradle bootJar --no-daemon | ||
|
||
FROM eclipse-temurin:17-jdk-alpine | ||
|
||
# Set the working directory | ||
# Install Python and dcron | ||
RUN apk update && apk add python3 py3-pip dcron py3-requests | ||
|
||
WORKDIR /app | ||
|
||
# Copy the JAR file from the build stage | ||
# Copy JAR and Python script | ||
COPY --from=build /app/build/libs/*.jar app.jar | ||
COPY chartwells_query.py /app/chartwells_query.py | ||
|
||
# Add crontab file and set permissions | ||
COPY crontab.txt /etc/crontabs/root | ||
|
||
# Make entrypoint executable | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# Expose port | ||
EXPOSE 8080 | ||
|
||
# Rub | ||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
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 @@ | ||
0 */2 * * * python3 /app/chartwells_query.py >> /var/log/cron.log 2>&1 |
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
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,12 @@ | ||
#!/bin/sh | ||
|
||
# Run at startup | ||
python3 /app/chartwells_query.py | ||
|
||
# Start dcron | ||
crond -b | ||
|
||
touch ./debug.file | ||
|
||
# Start DISH | ||
java -jar /app/app.jar |