ci: ajout de la pipeline Gitea Actions et configuration de l'application dans docker-compose
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
name: AS Talange CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Build & Run Unit Tests
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Run Maven Tests
|
||||
run: mvn clean test
|
||||
|
||||
deploy:
|
||||
name: Build & Run in Docker Container
|
||||
needs: test
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy with Docker Compose
|
||||
run: |
|
||||
echo "Building and restarting the application container..."
|
||||
docker compose down app || true
|
||||
docker compose up -d --build app
|
||||
echo "Application is running at http://localhost:8080"
|
||||
@@ -23,5 +23,21 @@ services:
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: astalange_app
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/astalange
|
||||
- SPRING_DATASOURCE_USERNAME=myuser
|
||||
- SPRING_DATASOURCE_PASSWORD=mypassword
|
||||
depends_on:
|
||||
- db
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user