Skip to content

Commit

Permalink
Merge pull request FPirazz#5 from FPirazz/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
MarzoliLeo authored Mar 7, 2024
2 parents 59a7b67 + e30f6c6 commit 4ae8582
Show file tree
Hide file tree
Showing 77 changed files with 16,560 additions and 20 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/action.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@

name: Build Gradle project
on:
push:
branches:
- main
- develop

jobs:
build-gradle-project:
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin' # Or other distributions like 'adopt'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew build
49 changes: 30 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
# Compiled class file
*.class
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar

# Log file
*.log
./gradle/

# BlueJ files
*.ctxt
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/

# Mobile Tools for Java (J2ME)
.mtj.tmp/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Start from the official OpenJDK Docker image
FROM openjdk:19-jdk-alpine

# Set a directory for the app
WORKDIR /app

# Install bash
RUN apk add --no-cache bash

# Copy the rest of the project files into the docker image
COPY . .

RUN chmod +x ./gradlew

# Remove Windows line endings from gradlew
RUN sed -i -e 's/\r$//' gradlew

# Build the project
RUN ./gradlew build --parallel

# Run the app using gradle
CMD ["./gradlew", "run"]

# Set bash as the entrypoint
ENTRYPOINT ["bash"]

# Commands for image generation and image execution
# docker build -t java-image .
# docker run -it --rm --name java-container java-image
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Traffic-Management
Project for both SPA and SPE


Link to the [documentation (DOC).](https://marzolileo.github.io/Traffic-Management/)
56 changes: 56 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
plugins {
id("org.danilopianini.git-sensitive-semantic-versioning") version "0.1.0"
id("java")
}

repositories {
mavenCentral()
}

java {
sourceCompatibility = JavaVersion.VERSION_19
targetCompatibility = JavaVersion.VERSION_19
}

tasks.wrapper {
gradleVersion = "8.2"
}

allprojects {
group = "org.SPE_SAP"
version = "0.0.1-SNAPSHOT"
repositories {
mavenCentral()
}
}

tasks.register("runAll") {
group = "run"
description = "Runs all the necessary component for the application"
dependsOn(":userContext:runUserApplication")
dependsOn(":tcm_frontend:npmRunVite")
dependsOn(":intersectionAggregate:runAgents")
}

tasks.register("cleanAll") {
group = "build"
dependsOn(":userContext:clean")
dependsOn(":tcm_frontend:npmClean")
dependsOn(":intersectionAggregate:clean")
}

tasks.register("buildAll") {
group = "build"
dependsOn(":userContext:build")
dependsOn(":tcm_frontend:npmBuildProject")
dependsOn(":intersectionAggregate:build")
}

tasks.register("cleanAndBuildAll") {
group = "build"
description = "Builds and cleans all the subproject of the application"
dependsOn("cleanAll")
dependsOn("buildAll")
}


20 changes: 20 additions & 0 deletions clean_docker_images.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Define the image names
$images = "tcm_frontend:latest", "fpirazzoli/sap_spe_db:latest", "src/main/userContext:latest"

# Loop through the images
foreach ($image in $images) {
# Pull the latest image
docker pull $image

# Get the image ID of the local image
$local_image_id = docker images -q $image

# Get the image ID of the remote image
$remote_image_id = docker inspect --format='{{.Id}}' $image

# Compare the image IDs
if ($local_image_id -ne $remote_image_id) {
# If the image IDs are different, remove the local image
docker rmi $local_image_id
}
}
14 changes: 14 additions & 0 deletions clean_docker_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Stop containers
docker stop vue-app
docker stop user_db
docker stop spring-db-app

# Remove containers
docker rm vue-app
docker rm user_db
docker rm spring-db-app

# Remove images
docker rmi tcm_frontend:latest fpirazzoli/sap_spe_db:latest src/main/userContext:latest
55 changes: 55 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.7"

services:

vue-app:
build:
context: tcm_frontend
dockerfile: Dockerfile
container_name: vue-app
restart: always
ports:
- "8080:80"

user-db:
image: "fpirazzoli/sap_spe_db:latest"
container_name: user-db
restart: always
ports:
- "8082:8082"
- "9092:9092"

spring-db-app:
build:
context: src/main/userContext
dockerfile: Dockerfile
container_name: spring-db-app
restart: always
ports:
- "9085:9085"

intersection-agents:
build:
context: intersectionAggregate
dockerfile: Dockerfile
container_name: intersection-agents
restart: always
ports:
- "9080:9080"
# nginx:
# image: "nginx:latest"
# container_name: nginx
# restart: always
# ports:
# - "8085:80"

#Per aggiungere un nuovo servizio
#Seguire il template:

#nome-servizio:
#image:
#ports:
#container-name:
# ecc.. ecc... (cambia a seconda delle necessità ma questi 3 sono quasi sempre obbligatori).

#Eseguire il comando "docker compose up" e fa tutto lui.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4ae8582

Please sign in to comment.