From fcb372023f273313600f921b16463c2ea75f6607 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Mon, 30 Mar 2026 10:33:01 +0200 Subject: [PATCH] feat: add Dockerfile and Gitea Actions CI pipeline Co-Authored-By: Claude Opus 4.6 (1M context) --- .gitea/workflows/ci.yml | 45 +++++++++++++++++++++++++++++++++++++++++ Dockerfile | 16 +++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 Dockerfile diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..d056d9f --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,45 @@ +# .gitea/workflows/ci.yml +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16-alpine + env: + POSTGRES_DB: cameleer_saas_test + POSTGRES_USER: test + POSTGRES_PASSWORD: test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: maven + + - name: Run tests + run: ./mvnw verify -B + env: + SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/cameleer_saas_test + SPRING_DATASOURCE_USERNAME: test + SPRING_DATASOURCE_PASSWORD: test + + - name: Build Docker image + run: docker build -t cameleer-saas:${{ github.sha }} . diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..851755f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# Dockerfile +FROM eclipse-temurin:21-jdk-alpine AS build +WORKDIR /build +COPY .mvn/ .mvn/ +COPY mvnw pom.xml ./ +RUN ./mvnw dependency:go-offline -B +COPY src/ src/ +RUN ./mvnw package -DskipTests -B + +FROM eclipse-temurin:21-jre-alpine +WORKDIR /app +RUN addgroup -S cameleer && adduser -S cameleer -G cameleer +COPY --from=build /build/target/*.jar app.jar +USER cameleer +EXPOSE 8080 +ENTRYPOINT ["java", "-jar", "app.jar"]