Skip to content

Commit 9a09f70

Browse files
committed
Docker image building on GitHub CI + Adds Dockerfile
1 parent fffb9bb commit 9a09f70

4 files changed

Lines changed: 68 additions & 2 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Push Docker Image
2+
on:
3+
push:
4+
branches: [ "main" ]
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-and-push:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Log in to the Container registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract Docker metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ghcr.io/${{ github.repository }}
37+
38+
- name: Build and push Docker image
39+
uses: docker/build-push-action@v6
40+
with:
41+
context: .
42+
push: true
43+
provenance: false
44+
platforms: linux/amd64, linux/arm64
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM gradle:9.4.1-jdk21 AS builder
2+
3+
WORKDIR /app
4+
COPY gradle ./gradle
5+
COPY build.gradle.kts ./
6+
COPY settings.gradle.kts ./
7+
COPY src ./src
8+
RUN gradle build --no-daemon
9+
10+
FROM eclipse-temurin:21-jre-alpine
11+
12+
WORKDIR /app
13+
RUN addgroup -S nolmax && adduser -S nolmax -G nolmax
14+
RUN chown nolmax:nolmax /app
15+
COPY --from=builder --chown=nolmax:nolmax /app/build/libs/*.jar /app/authAPI.jar
16+
USER nolmax:nolmax
17+
ENTRYPOINT ["java", "-jar", "/app/authAPI.jar"]

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Designed to be used in conjunction with [nolmax's main server](https://github.co
88
- On first run, the application will spawn a `config.yml` file next to the JAR executable and exit. Make sure to edit the configuration file to include the necessary server configuration and credentials.
99
- Start the server again, and the app will be online at the listening address and the listening port of your choice. By default, this is `0.0.0.0:63636`.
1010

11+
# Docker image
12+
- The configuration file can be inserted in the container with the path `/app/config.yml`.
13+
1114
# Startup arguments
1215
There are startup arguments that override their respective options in the configuration file when specified:
1316
```

src/main/java/com/qtpc/tech/nolmax/authapi/configuration/AppConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public static class Server {
3030
public static void createDefaultConfig(Path configPath) throws IOException {
3131
String defaultConfig = """
3232
database:
33-
address: ""
34-
port: 36363
33+
address: "127.0.0.1"
34+
port: 5432
3535
username: ""
3636
password: ""
3737
db: ""

0 commit comments

Comments
 (0)