Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.git
.github
.gradle
build
out
bin

.idea
.vscode
*.iml
*.ipr
*.iws
.classpath
.project
.settings
.factorypath
.apt_generated
.springBeans
.sts4-cache
nbproject
nbbuild
dist
nbdist
.nb-gradle

.env
.env.*
!.env.example
application-local.yml
application-dev.yml
application-prod.yml

logs
*.log
*.tmp
*.swp
.DS_Store
Thumbs.db

docker-compose*.yml
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on:
pull_request:
push:
branches:
- develop
- main

jobs:
build:
name: Build and Docker Image Check
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: gradle

- name: Make Gradle Wrapper executable
run: chmod +x ./gradlew

- name: Build Spring Boot jar
run: ./gradlew clean bootJar -x test --no-daemon

- name: Build Docker image
run: docker build -t slatto-api:ci .
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM eclipse-temurin:21-jdk-alpine AS build

WORKDIR /workspace

COPY gradlew settings.gradle build.gradle ./
COPY gradle ./gradle

RUN chmod +x ./gradlew
RUN ./gradlew dependencies --no-daemon

COPY src ./src

RUN ./gradlew clean bootJar -x test --no-daemon

FROM eclipse-temurin:21-jre-alpine AS runtime

WORKDIR /app

RUN addgroup -S spring && adduser -S spring -G spring

COPY --from=build /workspace/build/libs/*.jar app.jar

USER spring:spring

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "/app/app.jar"]
Loading