Skip to content

Commit 47d0d4a

Browse files
committed
chore: Automated docker builds
1 parent e20c83b commit 47d0d4a

4 files changed

Lines changed: 54 additions & 22 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: build java
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths-ignore:
7+
- README.md
8+
- docs
9+
- .github/workflows/docs.yml
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
15+
jobs:
16+
push:
17+
name: "Docker image push"
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up JDK
26+
uses: actions/setup-java@v3
27+
with:
28+
distribution: temurin
29+
java-version: 25
30+
31+
- name: Setup Gradle
32+
uses: gradle/actions/setup-gradle@v3
33+
34+
- name: Grant execute permission for gradlew
35+
shell: bash
36+
run: chmod +x gradlew
37+
38+
- name: Build
39+
run: ./gradlew publishImage
40+
env:
41+
DOCKER_PROJECT: ${{ env.REGISTRY }}/${{ github.repository }}
42+
DOCKER_USERNAME: ${{ github.actor }}
43+
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ _This applicatcion is built with Ktor and HTMX, with updates sent live using Ser
1717

1818
Clicky runs as a single JVM process, with rooms stored in memory. Restarting the app will kick users back to the homepage, but the upside is no database or filesystem setup is needed at all! We provide a Docker image for easy setup, a full list of environment variables with descriptions can be found in [application.yaml](https://github.com/0ffz/Clicky/blob/master/server/src/main/resources/application.yaml)
1919

20-
`TODO: setup automated builds via github action`
21-
2220
```yaml
2321
services:
2422
clicky:
@@ -37,6 +35,12 @@ To get HTTPS encryption on your website, use a reverse proxy such as traefik, ca
3735

3836
# Development
3937

38+
Build commands:
39+
40+
- Run local server: `./gradlew run`
41+
- Build Docker image: `./gradlew publishImageToLocalRegistry`
42+
43+
## Architecture
4044
_This app was originally an experiment rewriting an old [Django](https://github.com/0ffz/Clicky-django) application I made using HTMX, I will try to link to a blog post here once finished._ Below is a quick overview of the app architecture:
4145

4246
- Ktor serves pages using the Kotlin HTML DSL. They include HTMX as a small JavaScript dependency and style components using Tailwind classes (with the stylesheet generated by a small Gradle plugin.)

server/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ ktor {
6969
docker {
7070
jreVersion = JavaVersion.VERSION_25
7171
localImageName = "ghcr.io/0ffz/clicky"
72+
externalRegistry = io.ktor.plugin.features.DockerImageRegistry.externalRegistry(
73+
username = providers.environmentVariable("DOCKER_USERNAME"),
74+
password = providers.environmentVariable("DOCKER_PASSWORD"),
75+
project = providers.environmentVariable("DOCKER_PROJECT")
76+
)
7277
}
7378
}
7479

server/src/test/kotlin/ApplicationTest.kt

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

0 commit comments

Comments
 (0)