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
43 changes: 43 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Common
README.md
CHANGELOG.md
docker-compose.yml
Dockerfile

# Git folder #
/.git/

# Compilation folders #
/bin/
/target/
/build/

# Log files #
/*.log
/*.log.*

# Eclipse files #
.buildpath
.classpath
.cproject
.externalToolBuilders/
.launch
.loadpath
.metadata
.project
.settings/
bin/**
tmp/**
tmp/**/*
*.tmp
*.nak
*.swp
*~.nib
*.pydevproject
local.properties
/src/main/resources/rebel.xml
.springBeans

# IntelliJ Idea files #
.idea
*.iml
32 changes: 0 additions & 32 deletions .github/workflows/doc_deployment.yml

This file was deleted.

26 changes: 21 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@ name: Tests
on: [push, pull_request]

jobs:
tests_17:
name: Tests with JDK 17
uses: Bernardo-MG/github-workflow-maven/.github/workflows/testing.yml@v1
with:
jdk: 17
tests:
name: Tests with JDK ${{ matrix.jdk }}
runs-on: ubuntu-latest

strategy:
matrix:
jdk: [17, 21]

steps:
- name: Check-out
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
cache: 'maven'
- name: Run up to integration tests
run: mvn verify -fae
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Log files #
/*.log
/*.log.*
/logs/**

# Output folders #
/test-output/
Expand Down Expand Up @@ -48,6 +49,10 @@ local.properties
.idea
*.iml

# Visual Studio #
.vscode/
.factorypath

# Windows files #
Thumbs.db
Desktop.ini
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022-2023 Bernardo Martínez Garrido
Copyright (c) 2022-2025 Bernardo Martínez Garrido

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 47 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -----------------------------------------------------------------------------
# BUILD STAGE
# -----------------------------------------------------------------------------
FROM maven:3.9.9-eclipse-temurin-22-alpine as build

# Create app directory
WORKDIR /app

# Resolve and cache dependencies
COPY ./pom.xml .
RUN mvn dependency:go-offline

# Copy and build
COPY ./src ./src
RUN mvn --batch-mode clean package -DskipTests

# -----------------------------------------------------------------------------
# DEPLOYMENT STAGE
# -----------------------------------------------------------------------------
FROM eclipse-temurin:22-jre-alpine as deployment

WORKDIR /app

# Exposed ports
EXPOSE 8080
EXPOSE 8000

# Health check
HEALTHCHECK --interval=30s --retries=5 --timeout=10s CMD curl --fail --silent localhost:8080/actuator/health | grep UP || exit 1

# Create runner user
RUN addgroup -S runners && \
adduser --disabled-password -S runner -G runners

# Add logs folder and assign to runner user
RUN mkdir ./logs && \
chown runner ./logs
VOLUME ./logs

# Change to runner user
USER runner

# Copy from build stage
COPY --from=build ./app/target/*.war ./app.war

# Run with remote debugging
CMD ["java", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:8000", "-jar", "app.war"]
47 changes: 47 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3'
services:
basic-db:
image: postgres:15.0-alpine
environment:
PGUSER: 'postgres'
POSTGRES_DB: 'postgres'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready", "-U postgres"]
interval: 30s
timeout: 10s
retries: 5
networks:
- db
basic-ws:
build:
context: ../
dockerfile: ./docker/Dockerfile
ports:
- "8080:8080"
- "8000:8000"
depends_on:
basic-db:
condition: service_healthy
healthcheck:
test: "wget -T5 -qO- http://localhost:8080/actuator/health | grep UP || exit 1"
interval: 2s
timeout: 3s
retries: 5
start_period: 60s
environment:
# JDBC
- spring.datasource.url=jdbc:postgresql://basic-db:5432/postgres
- spring.datasource.username=postgres
- spring.datasource.password=password
volumes:
- basic-logs:/app/logs
networks:
- db
volumes:
basic-logs:
networks:
db:
Loading
Loading