Skip to content

Commit

Permalink
refactor: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CristianoMends committed Jan 31, 2025
1 parent 0387afe commit acfbe8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Continuous Integration


on:
push:
branches:
Expand All @@ -15,12 +14,11 @@ jobs:
runs-on: ubuntu-latest
env:
SPRING_PROFILES_ACTIVE: prod
DB_URL: jdbc:postgresql://localhost:5433/sysagua_db
DB_USERNAME: postgres
DB_PASSWORD: testpassword
DEFAULT_EMAIL: admin@sysagua.com
DEFAULT_PASSWORD: admin123
JWT_SECRET_KEY: your-secret-key
JWT_SECRET_KEY: test-secret-key

steps:
# Checkout do código-fonte
Expand Down Expand Up @@ -54,8 +52,6 @@ jobs:
# Início dos serviços com Docker Compose
- name: Start Docker Compose
run: docker-compose up --build -d
env:
DB_PASSWORD: testpassword

# Aguarda que os serviços estejam prontos
- name: Wait for services to be ready
Expand All @@ -67,15 +63,6 @@ jobs:
done
echo "API service is ready!"'
# permissões gradlew
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

# Execução de testes da API usando Gradle
- name: Run API Tests
working-directory: ./sysagua-api
run: ./gradlew test

# Logs de depuração (opcional)
- name: Check Docker logs
run: docker-compose logs --tail=100
Expand Down
14 changes: 4 additions & 10 deletions sysagua-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,21 @@
FROM gradle:8.11.1-jdk-21-and-23-jammy AS BUILD
WORKDIR /usr/app/

# Copia apenas os arquivos necessários
COPY build.gradle settings.gradle /gradle ./
COPY src ./src
COPY . /usr/app/

# Realiza o build da aplicação
RUN gradle clean build -x test
RUN chmod +x gradlew

RUN gradle clean build

# Etapa 2: Runtime
FROM eclipse-temurin:21-jre AS RUNTIME

# Variáveis para configuração do aplicativo
ENV APP_HOME=/usr/app/
ENV JAR_NAME=app.jar

WORKDIR $APP_HOME

# Copia o arquivo JAR gerado na etapa de build
COPY --from=BUILD $APP_HOME/build/libs/*.jar $JAR_NAME

# Expondo a porta da aplicação
EXPOSE 8080

# Comando de entrada configurável
ENTRYPOINT ["java", "-jar", "app.jar"]

0 comments on commit acfbe8d

Please sign in to comment.