Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ jobs:
with:
java-version: '25'

- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: emails/package-lock.json

- name: Build JAR
run: |
chmod +x ./gradlew
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ out/

### VS Code ###
.vscode/
.worktrees/
emails/node_modules/
emails/dist/
46 changes: 46 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ plugins {
id 'io.spring.dependency-management' version '1.1.7'
}

def emailsDir = layout.projectDirectory.dir('emails')
def renderedEmailsDir = layout.projectDirectory.dir('emails/dist/rendered')
def templatesDir = layout.projectDirectory.dir('src/main/resources/templates')
def npmCommand = System.getProperty('os.name').toLowerCase().contains('windows') ? 'npm.cmd' : 'npm'

group = 'me.june8th'
version = '1.0.0-dev'
description = 'TicketRushServer'
Expand Down Expand Up @@ -51,3 +56,44 @@ dependencies {
tasks.withType(Test).configureEach {
useJUnitPlatform()
}

tasks.register('npmInstallEmails', Exec) {
group = 'build'
description = 'Installs npm dependencies for the email workspace.'
workingDir = emailsDir.asFile
commandLine npmCommand, 'ci'
inputs.file('emails/package-lock.json')
outputs.dir('emails/node_modules')
}

tasks.register('buildEmailTemplates', Exec) {
group = 'build'
description = 'Builds static email HTML from the React email workspace.'
dependsOn tasks.named('npmInstallEmails')
workingDir = emailsDir.asFile
commandLine npmCommand, 'run', 'build'

inputs.files(
fileTree(dir: 'emails/src'),
fileTree(dir: 'emails/scripts'),
'emails/package.json',
'emails/package-lock.json',
'emails/tsconfig.json',
'emails/vite.config.ts'
)
outputs.dir(renderedEmailsDir)
}

tasks.register('syncEmailTemplates', Sync) {
group = 'build'
description = 'Copies rendered email HTML into Spring template resources.'
dependsOn tasks.named('buildEmailTemplates')

from(renderedEmailsDir)
include '*.html'
into templatesDir
}

tasks.named('processResources') {
dependsOn tasks.named('syncEmailTemplates')
}
11 changes: 11 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
FROM eclipse-temurin:25-jdk-alpine AS builder

ENV NVM_DIR=/root/.nvm

RUN apk add --no-cache bash curl && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
bash -c ". \"$NVM_DIR/nvm.sh\" && \
nvm install --lts && \
nvm use --lts && \
ln -sf \"\$(nvm which current)\" /usr/local/bin/node && \
ln -sf \"\$(dirname \"\$(nvm which current)\")/npm\" /usr/local/bin/npm && \
ln -sf \"\$(dirname \"\$(nvm which current)\")/npx\" /usr/local/bin/npx"

WORKDIR /app
COPY . .
RUN ./gradlew bootJar -x test --no-daemon
Expand Down
Loading
Loading