Skip to content

Commit cdc2f00

Browse files
committed
Build docker images using github actions
1 parent ac58080 commit cdc2f00

File tree

5 files changed

+56
-11
lines changed

5 files changed

+56
-11
lines changed

.github/workflows/botfest.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
runs-on: ubuntu-latest
4141
needs: test
4242
if: github.ref == 'refs/heads/prod'
43+
permissions:
44+
contents: read
45+
packages: write
46+
attestations: write
47+
id-token: write
4348
steps:
4449
- name: Checkout repository
4550
uses: actions/checkout@v4
@@ -50,9 +55,21 @@ jobs:
5055
- name: Build project and generate docker file
5156
run: ./gradlew botfest:createDockerfile
5257

58+
- name: Login to GitHub Container Registry
59+
uses: docker/login-action@v3
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.repository_owner }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Docker meta
66+
id: meta
67+
uses: docker/metadata-action@v5
68+
5369
- name: Build and push docker image
5470
uses: docker/build-push-action@v6
5571
with:
5672
context: "botfest/build"
5773
push: true
58-
tags: modfest/botfest:latest
74+
tags: ghcr.io/modfest/botfest:latest
75+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/panel.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
publish:
1818
runs-on: ubuntu-latest
1919
if: github.ref == 'refs/heads/prod'
20+
permissions:
21+
contents: read
22+
packages: write
23+
attestations: write
24+
id-token: write
2025
steps:
2126
- name: Checkout repository
2227
uses: actions/checkout@v4
@@ -28,10 +33,15 @@ jobs:
2833
username: ${{ github.repository_owner }}
2934
password: ${{ secrets.GITHUB_TOKEN }}
3035

36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
3140
- name: Build and push docker image
3241
uses: docker/build-push-action@v6
3342
with:
3443
context: "."
3544
file: "panel/Dockerfile"
3645
push: true
37-
tags: modfest/platform_api:latest
46+
tags: ghcr.io/modfest/panel:latest
47+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/platform_api.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
runs-on: ubuntu-latest
4141
needs: test
4242
if: github.ref == 'refs/heads/prod'
43+
permissions:
44+
contents: read
45+
packages: write
46+
attestations: write
47+
id-token: write
4348
steps:
4449
- name: Checkout repository
4550
uses: actions/checkout@v4
@@ -50,9 +55,21 @@ jobs:
5055
- name: Build project and generate docker file
5156
run: ./gradlew platform_api:createDockerfile
5257

58+
- name: Login to GitHub Container Registry
59+
uses: docker/login-action@v3
60+
with:
61+
registry: ghcr.io
62+
username: ${{ github.repository_owner }}
63+
password: ${{ secrets.GITHUB_TOKEN }}
64+
65+
- name: Docker meta
66+
id: meta
67+
uses: docker/metadata-action@v5
68+
5369
- name: Build and push docker image
5470
uses: docker/build-push-action@v6
5571
with:
5672
context: "platform_api/build"
5773
push: true
58-
tags: modfest/platform_api:latest
74+
tags: ghcr.io/modfest/platform_api:latest
75+
labels: ${{ steps.meta.outputs.labels }}

panel/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ ENV NODE_ENV=production
4242
RUN addgroup --system --gid 1001 nodejs
4343
RUN adduser --system --uid 1001 nextjs
4444

45-
COPY --from=builder /app/panel/public ./public
46-
4745
# Automatically leverage output traces to reduce image size
4846
# https://nextjs.org/docs/advanced-features/output-file-tracing
4947
COPY --from=builder --chown=nextjs:nodejs /app/panel/.next/standalone ./

platform_api/build.gradle.kts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ tasks.bootRun {
9393
)
9494
}
9595

96-
tasks.createDockerfile { dependsOn("bootBuildImage") }
96+
tasks.createDockerfile { dependsOn("bootJar") }
9797
docker {
9898
generateOnBuild = false
9999

@@ -113,15 +113,18 @@ docker {
113113

114114
workdir("/app")
115115

116-
val filename = tasks.bootBuildImage.get().archiveFile.get()
116+
val filename = tasks.bootJar.get().archiveFile.get()
117117
.asFile.relativeTo(dockerfileLocation.parentFile)
118118
copy("$filename", "/app/app.jar")
119119

120-
runShell("mkdir -p /var/lib/platform/data")
120+
runShell("mkdir -p /app/data")
121121

122-
env {
123-
add("SERVER_PORT", "8080")
124-
}
122+
add(object : DockerfileCommand() {
123+
override val keyword: String
124+
get() = "ENV"
125+
126+
override fun toString(): String = "ENV SERVER_PORT=8080 PLATFORM_DATADIR=/app/data"
127+
})
125128

126129
expose(8080)
127130
entryPointExec(

0 commit comments

Comments
 (0)