Skip to content

Commit e44c7a4

Browse files
committed
2 parents bfd1bc0 + 313ee35 commit e44c7a4

File tree

5 files changed

+100
-0
lines changed

5 files changed

+100
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Compile Java Backend
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
compile-backend:
7+
runs-on: ubuntu-latest
8+
name: Compile Backend Code
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up JDK
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: '17'
17+
18+
- name: Compile with Maven
19+
run: |
20+
cd app
21+
mvn clean compile
22+

.github/workflows/lint-backend.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint Java Backend
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint-java:
7+
runs-on: ubuntu-latest
8+
name: Checkstyle Java Linting
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up JDK
13+
uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: '17'
17+
18+
- name: Download Checkstyle
19+
run: curl -L -o checkstyle.jar https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.12.1/checkstyle-10.12.1-all.jar
20+
21+
- name: Run Checkstyle
22+
run: |
23+
java -jar checkstyle.jar -c /google_checks.xml app/src/main/java/com/project/back_end || true

.github/workflows/lint-docker.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint Dockerfiles
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
dockerlint:
7+
runs-on: ubuntu-latest
8+
name: Lint Dockerfiles
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Run hadolint
13+
uses: hadolint/[email protected]
14+
with:
15+
dockerfile: ./app/Dockerfile
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Lint Frontend
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint-frontend:
7+
runs-on: ubuntu-latest
8+
name: Lint HTML, CSS, and JS
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: '18'
16+
17+
- name: Install linters
18+
run: |
19+
npm install -g htmlhint stylelint eslint
20+
21+
- name: Lint HTML
22+
run: htmlhint app/src/main/resources/static/assets/pages//*.html || true
23+
24+
- name: Lint CSS
25+
run: stylelint "app/src/main/resources/static/assets/css//*.css" || true
26+
27+
- name: Lint JS
28+
run: eslint app/src/main/resources/static/assets/js//*.js || true

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Step 1: Use Maven with JDK 17 to build the app
2+
FROM maven:3.9.9-eclipse-temurin-17 AS builder
3+
WORKDIR /app
4+
COPY pom.xml .
5+
COPY src ./src
6+
RUN mvn clean package -DskipTests
7+
# Step 2: Use lightweight JRE 17 for running the app
8+
FROM eclipse-temurin:17.0.15_6-jre
9+
WORKDIR /app
10+
COPY --from=builder /app/target/back-end-0.0.1-SNAPSHOT.jar app.jar
11+
EXPOSE 8080
12+
ENTRYPOINT ["java", "-jar", "app.jar"]

0 commit comments

Comments
 (0)