Skip to content

Commit

Permalink
Added CI deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
samie committed Jan 29, 2024
1 parent a720566 commit 85a65aa
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/deploy.yml
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
37 changes: 37 additions & 0 deletions demo-app/Dockerfile
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"]
12 changes: 12 additions & 0 deletions demo-app/fly.toml
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

0 comments on commit 85a65aa

Please sign in to comment.