Skip to content

Commit 0e0ec8e

Browse files
committed
feat: update ci/cd workflows and docker build configuration
1 parent 29bcf8a commit 0e0ec8e

File tree

7 files changed

+137
-13
lines changed

7 files changed

+137
-13
lines changed

.dockerignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### Environment variables ###
2+
*.env
3+
4+
### Build output folder ###
5+
target/
6+
!**/src/main/**/target/
7+
!**/src/test/**/target/
8+
out/
9+
!**/src/main/**/out/
10+
!**/src/test/**/out/
11+
build/
12+
!**/src/main/**/build/
13+
!**/src/test/**/build/
14+
15+
### IntelliJ IDEA ###
16+
.idea/
17+
18+
### Eclipse ###
19+
.apt_generated
20+
.classpath
21+
.factorypath
22+
.project
23+
.settings
24+
.springBeans
25+
.sts4-cache
26+
27+
### NetBeans ###
28+
/nbproject/private/
29+
/nbbuild/
30+
/dist/
31+
/nbdist/
32+
/.nb-gradle/
33+
34+
35+
### VS Code ###
36+
.vscode/
37+
38+
### Mac OS ###
39+
.DS_Store
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build Docker Image
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
packages: write
7+
8+
jobs:
9+
build-server-docker-image:
10+
name: Build Server Docker Image
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v5
15+
16+
- name: Log in to GitHub Container Registry
17+
uses: docker/login-action@v3
18+
with:
19+
registry: ghcr.io
20+
username: ${{ github.actor }}
21+
password: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Extract metadata for Docker
24+
id: meta
25+
uses: docker/metadata-action@v5
26+
with:
27+
images: ghcr.io/${{ github.repository }}
28+
tags: |
29+
type=raw,value=latest
30+
type=ref,event=tag,format=short
31+
32+
- name: Build and push Docker image
33+
uses: docker/build-push-action@v5
34+
with:
35+
context: .
36+
file: Dockerfile
37+
push: true
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/build-jar.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Build JAR executable
22
on:
3-
# push:
4-
# branches-ignore:
5-
# - master
63
pull_request:
74
branches:
85
- master
@@ -26,8 +23,8 @@ jobs:
2623

2724
- name: Build Desktop JAR
2825
run: |
29-
mvn -B -f ./pom.xml clean install
30-
mvn -B -f ./desktop/pom.xml package
26+
mvn -B -f ./pom.xml clean install -DskipTests
27+
mvn -B -f ./desktop/pom.xml package -DskipTests
3128
3229
- name: Upload Desktop JAR artifact
3330
if: github.event_name != 'release'
@@ -58,7 +55,7 @@ jobs:
5855

5956
- name: Build Server JAR
6057
run: |
61-
mvn -B -f ./server/pom.xml clean package spring-boot:repackage
58+
mvn -B -f ./server/pom.xml clean package spring-boot:repackage -DskipTests
6259
6360
- name: Upload Server JAR artifact
6461
if: github.event_name != 'release'

.github/workflows/run-test.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ on:
33
push:
44
branches-ignore:
55
- master
6-
# pull_request:
7-
# branches:
8-
# - master
96
workflow_dispatch:
107

118
jobs:

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Build stage
2+
FROM maven:3.9.11-eclipse-temurin-21 AS build
3+
WORKDIR /build
4+
COPY . .
5+
RUN mvn -f ./server/pom.xml clean package spring-boot:repackage -DskipTests
6+
7+
# Image
8+
FROM eclipse-temurin:21.0.8_9-jre-alpine
9+
ARG version=1.3.6
10+
LABEL authors="me@june8th.eu.org"
11+
LABEL version="${version}"
12+
WORKDIR /app
13+
COPY --from=build /build/server/target/server-${version}.jar .
14+
EXPOSE 36018/tcp
15+
ENTRYPOINT ["java", "-jar", "server-1.3.6.jar"]

docker-compose.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: exterminator3618
2+
3+
services:
4+
mysql:
5+
image: mysql:9.5
6+
container_name: exterminator3618-mysql
7+
environment:
8+
MYSQL_ROOT_PASSWORD: testpassword101
9+
MYSQL_DATABASE: exterminator3618
10+
# ports:
11+
# - "3306:3306/tcp"
12+
volumes:
13+
- exterminator3618-server-data:/var/lib/mysql
14+
healthcheck:
15+
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
16+
interval: 30s
17+
timeout: 30s
18+
retries: 3
19+
start_period: 5s
20+
restart: unless-stopped
21+
22+
server:
23+
build:
24+
context: .
25+
dockerfile: Dockerfile
26+
container_name: exterminator3618-server
27+
environment:
28+
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/exterminator3618
29+
SPRING_DATASOURCE_USERNAME: root
30+
SPRING_DATASOURCE_PASSWORD: testpassword101
31+
EXTERMINATOR3618_ADMIN_ALLOW-ACCESS: false
32+
# EXTERMINATOR3618_ADMIN_ACCESS-TOKEN: your_admin_access_token_here
33+
ports:
34+
- "36018:36018/tcp"
35+
depends_on:
36+
mysql:
37+
condition: service_healthy
38+
restart: unless-stopped
39+
40+
volumes:
41+
exterminator3618-server-data:

server/Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)