forked from blueb/ask-kt
Compare commits
3 commits
e8fdc11878
...
4b7f68278b
| Author | SHA1 | Date | |
|---|---|---|---|
|
4b7f68278b |
|||
|
836c65b4a8 |
|||
|
96bed6d4c3 |
3 changed files with 148 additions and 4 deletions
76
.forgejo/workflows/dev.yaml
Normal file
76
.forgejo/workflows/dev.yaml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
name: Development Docker images
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
env:
|
||||
IMAGE_NAME: ask-kt
|
||||
IMAGE_REGISTRY: ghcr.io/${{ forgejo.repository_owner }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build development images
|
||||
runs-on: docker
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Generate build tag
|
||||
id: build-tag
|
||||
run: |
|
||||
TZ=Etc/UTC
|
||||
TIME=$(date +'%Y-%m-%d')
|
||||
echo "ASKKT_BUILD_DATE=$(echo ${TIME}-DEVELOPMENT)" >> $FORGEJO_ENV
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
id: checkout
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
id: buildx
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Image Metadata
|
||||
uses: docker/metadata-action@v6
|
||||
id: meta
|
||||
with:
|
||||
images: |
|
||||
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||
org.opencontainers.image.description=A simple & featureful multi-user Q&A software, written in Kotlin.
|
||||
tags: |
|
||||
type=raw,value=dev
|
||||
type=raw,value=${{ env.ASKKT_BUILD_DATE }}
|
||||
type=sha
|
||||
|
||||
- name: Login to the Registry
|
||||
uses: docker/login-action@v4
|
||||
id: registry
|
||||
if: forgejo.event_name != 'pull_request'
|
||||
with:
|
||||
registry: git.gay
|
||||
username: ${{ forgejo.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Build and Push to GHCR
|
||||
uses: docker/build-push-action@v7
|
||||
id: build-push
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
push: ${{ forgejo.event_name != 'pull_request' }}
|
||||
platforms: ${{ steps.buildx.outputs.platforms }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
env:
|
||||
DIGEST: ${{ steps.build.outputs.digest }}
|
||||
TAGS: ${{ steps.meta.outputs.tags }}
|
||||
69
.forgejo/workflows/snapshot.yaml
Normal file
69
.forgejo/workflows/snapshot.yaml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: Snapshot Docker images
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*-SNAPSHOT'
|
||||
env:
|
||||
IMAGE_NAME: ask-kt
|
||||
IMAGE_REGISTRY: git.gay/${{ forgejo.repository_owner }}
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
name: Build Snapshot images
|
||||
runs-on: docker
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
id: checkout
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
id: buildx
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Image Metadata
|
||||
uses: docker/metadata-action@v6
|
||||
id: meta
|
||||
with:
|
||||
images: |
|
||||
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
labels: |
|
||||
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||
org.opencontainers.image.description=A simple & featureful multi-user Q&A software, written in Kotlin.
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=raw,value=snapshot
|
||||
type=raw,value=${{ forgejo.ref_name }}
|
||||
type=sha
|
||||
|
||||
- name: Login to the Registry
|
||||
uses: docker/login-action@v4
|
||||
id: registry
|
||||
if: forgejo.event_name != 'pull_request'
|
||||
with:
|
||||
registry: git.gay
|
||||
username: ${{ forgejo.actor }}
|
||||
password: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
- name: Build and Push to GHCR
|
||||
uses: docker/build-push-action@v7
|
||||
id: build-push
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
push: ${{ forgejo.event_name != 'pull_request' }}
|
||||
platforms: ${{ steps.buildx.outputs.platforms }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
env:
|
||||
DIGEST: ${{ steps.build.outputs.digest }}
|
||||
TAGS: ${{ steps.meta.outputs.tags }}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# https://ktor.io/docs/docker.html#-sbmfeb_140
|
||||
|
||||
# Stage 1: Cache Gradle dependencies
|
||||
FROM gradle:9.2.1-jdk21 AS cache
|
||||
FROM gradle:9.4-jdk21 AS cache
|
||||
RUN mkdir -p /home/gradle/cache_home
|
||||
ENV GRADLE_USER_HOME=/home/gradle/cache_home
|
||||
COPY build.gradle.* gradle.properties /home/gradle/app/
|
||||
|
|
@ -10,7 +10,7 @@ WORKDIR /home/gradle/app
|
|||
RUN gradle dependencies --no-daemon
|
||||
|
||||
# Stage 2: Build Application
|
||||
FROM gradle:9.2.1-jdk21 AS build
|
||||
FROM gradle:9.4-jdk21 AS build
|
||||
COPY --from=cache /home/gradle/cache_home /home/gradle/.gradle
|
||||
COPY --chown=gradle:gradle . /home/gradle/src
|
||||
WORKDIR /home/gradle/src
|
||||
|
|
@ -19,9 +19,8 @@ WORKDIR /home/gradle/src
|
|||
RUN gradle build --no-daemon
|
||||
|
||||
# Stage 3: Create the Runtime Image
|
||||
FROM amazoncorretto:21 AS runtime
|
||||
FROM eclipse-temurin:25-jre AS runtime
|
||||
EXPOSE 8080
|
||||
RUN mkdir /app
|
||||
COPY --from=build /home/gradle/src/build/libs/*-all.jar /app/askkt-all.jar
|
||||
ENTRYPOINT ["java","-jar","/app/askkt-all.jar", "migration:executeAndStart"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue