-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Fly Deploy | ||
on: [push] | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy demo-app |
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,37 @@ | ||
# First stage: JDK build | ||
FROM openjdk:17 AS build | ||
|
||
# Update package lists and Install Maven | ||
RUN microdnf update -y && \ | ||
microdnf install -y maven && \ | ||
microdnf clean all | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Copy rest of the dependencies. | ||
COPY pom.xml . | ||
RUN mvn dependency:go-offline | ||
|
||
# Copy the source code | ||
COPY . . | ||
|
||
## Do the build | ||
RUN mvn clean install -Pproduction | ||
|
||
# Second stage: Lightweight jdk-slim image | ||
FROM openjdk:17-jdk-slim | ||
RUN useradd -m appuser | ||
|
||
RUN mkdir /app && \ | ||
chown -R appuser /app | ||
|
||
USER appuser | ||
|
||
WORKDIR /app | ||
|
||
# Copy the native binary from the build stage | ||
COPY --from=build /usr/src/app/target/idle-demo-*.jar /app/app.jar | ||
|
||
# Run the application | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java", "-jar", "/app/app.jar"] |
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 @@ | ||
app = "idle-demo" | ||
primary_region = "fra" | ||
|
||
[env] | ||
PORT = "8080" | ||
|
||
[http_service] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 |