Compare commits
2 commits
dbb45646d4
...
4f0be9919f
Author | SHA1 | Date | |
---|---|---|---|
4f0be9919f | |||
b8b83baa72 |
8 changed files with 60 additions and 87 deletions
13
.containerignore
Normal file
13
.containerignore
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
*
|
||||||
|
!db/src/
|
||||||
|
!db/pom.xml
|
||||||
|
!bot/src/
|
||||||
|
!bot/pom.xml
|
||||||
|
!migration/src/
|
||||||
|
!migration/pom.xml
|
||||||
|
!web/src/
|
||||||
|
!web/pom.xml
|
||||||
|
!pom.xml
|
||||||
|
web/src/ui/node_modules
|
||||||
|
web/src/ui/node
|
||||||
|
web/src/ui/dist
|
|
@ -1,13 +0,0 @@
|
||||||
*
|
|
||||||
!src/
|
|
||||||
!pom.xml
|
|
||||||
!ui/package*.json
|
|
||||||
!ui/postcss.config.js
|
|
||||||
!ui/tailwind.config.js
|
|
||||||
!ui/env.d..ts
|
|
||||||
!ui/vite.config.ts
|
|
||||||
!ui/tsconfig.json
|
|
||||||
!ui/tsconfig.node.json
|
|
||||||
!ui/index.html
|
|
||||||
!ui/public/
|
|
||||||
!ui/src/
|
|
43
Containerfile
Normal file
43
Containerfile
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Stage 1: Build bot
|
||||||
|
FROM docker.io/maven:3.9-eclipse-temurin-19 AS maven
|
||||||
|
WORKDIR /app
|
||||||
|
# Copy the dependency specifications
|
||||||
|
COPY pom.xml .
|
||||||
|
COPY db/pom.xml db/
|
||||||
|
COPY bot/pom.xml bot/
|
||||||
|
COPY migration/pom.xml migration/
|
||||||
|
COPY web/pom.xml web/
|
||||||
|
# Resolve dependencies for shared libraries
|
||||||
|
RUN mvn -pl db -am dependency:go-offline
|
||||||
|
# Install the shared libraries in the local Maven repo (`.m2`)
|
||||||
|
# This will also install the `root` module.
|
||||||
|
COPY db db
|
||||||
|
RUN mvn -pl db -am install
|
||||||
|
# Resolve dependencies for modules without dependencies to each other
|
||||||
|
RUN mvn dependency:go-offline
|
||||||
|
# Build modules
|
||||||
|
COPY web web
|
||||||
|
RUN mvn -pl web package
|
||||||
|
COPY bot bot
|
||||||
|
RUN mvn -pl bot package
|
||||||
|
COPY migration migration
|
||||||
|
RUN mvn -pl migration package
|
||||||
|
|
||||||
|
# Stage 2: Create final web
|
||||||
|
FROM docker.io/eclipse-temurin:19-jdk-alpine AS web
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=maven /app/web/target/web-*-fat.jar /app/web.jar
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["java", "-jar", "/app/web.jar"]
|
||||||
|
|
||||||
|
# Stage 2: Create final migration
|
||||||
|
FROM docker.io/eclipse-temurin:19-jdk-alpine AS migration
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=maven /app/migration/target/migration-*-fat.jar /app/migration.jar
|
||||||
|
CMD ["java", "-jar", "/app/migration.jar"]
|
||||||
|
|
||||||
|
# Stage 2: Create final bot
|
||||||
|
FROM docker.io/eclipse-temurin:19-jdk-alpine AS bot
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=maven /app/bot/target/bot-*-fat.jar /app/bot.jar
|
||||||
|
CMD ["java", "-jar", "/app/bot.jar"]
|
25
Dockerfile
25
Dockerfile
|
@ -1,25 +0,0 @@
|
||||||
# Stage 1: Build java application
|
|
||||||
FROM docker.io/maven:3.9-eclipse-temurin-19 AS maven
|
|
||||||
WORKDIR /app
|
|
||||||
COPY pom.xml .
|
|
||||||
RUN mvn dependency:go-offline
|
|
||||||
RUN mvn package
|
|
||||||
COPY src/ /app/src/
|
|
||||||
RUN mvn package
|
|
||||||
|
|
||||||
# Stage 2: Build vuejs application
|
|
||||||
FROM docker.io/node:18-slim AS vuejs
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./ui/package* .
|
|
||||||
RUN npm ci
|
|
||||||
COPY ./ui .
|
|
||||||
RUN npm run build-only
|
|
||||||
|
|
||||||
# Stage 3: Create the jlink app
|
|
||||||
FROM docker.io/eclipse-temurin:19-jdk-alpine
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=maven /app/target/dchat-*-fat.jar /app/dchat.jar
|
|
||||||
COPY --from=vuejs /app/dist /app/ui/dist
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
CMD ["java", "--enable-preview", "-jar", "/app/dchat.jar"]
|
|
14
build.sh
14
build.sh
|
@ -3,9 +3,6 @@
|
||||||
AUTHORS="Augusto Dwenger J. <dwenger@posteo.de>"
|
AUTHORS="Augusto Dwenger J. <dwenger@posteo.de>"
|
||||||
URL="https://${REPO}"
|
URL="https://${REPO}"
|
||||||
VENDOR="hamburghammer"
|
VENDOR="hamburghammer"
|
||||||
TITLE="dchat"
|
|
||||||
DESCRIPTION="A Discord bot to chat with ChatGPT from OpenAI"
|
|
||||||
|
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
CREATED=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
CREATED=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
@ -24,7 +21,7 @@ build() {
|
||||||
--label "org.opencontainers.image.vendor=${VENDOR}" \
|
--label "org.opencontainers.image.vendor=${VENDOR}" \
|
||||||
--label "org.opencontainers.image.title=${TITLE}" \
|
--label "org.opencontainers.image.title=${TITLE}" \
|
||||||
--label "org.opencontainers.image.description=${DESCRIPTION}" \
|
--label "org.opencontainers.image.description=${DESCRIPTION}" \
|
||||||
.. || exit $?
|
. || exit $?
|
||||||
|
|
||||||
if [ "$PUSH_LATEST" == "1" ]; then
|
if [ "$PUSH_LATEST" == "1" ]; then
|
||||||
podman push "${IMAGE_LATEST}"
|
podman push "${IMAGE_LATEST}"
|
||||||
|
@ -32,25 +29,22 @@ build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "start building bot"
|
echo "start building bot"
|
||||||
cd "./bot" || exit 1
|
|
||||||
REPO="git.hhhammer.de/hamburghammer/dchat/bot"
|
REPO="git.hhhammer.de/hamburghammer/dchat/bot"
|
||||||
TITLE="dchat-bot"
|
TITLE="dchat-bot"
|
||||||
DESCRIPTION="A Discord bot to chat with ChatGPT from OpenAI"
|
DESCRIPTION="A Discord bot to chat with ChatGPT from OpenAI"
|
||||||
|
DOCKER_BUILD_ARGS="--target bot"
|
||||||
build
|
build
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo "start building web"
|
echo "start building web"
|
||||||
cd "./web" || exit 1
|
|
||||||
REPO="git.hhhammer.de/hamburghammer/dchat/web"
|
REPO="git.hhhammer.de/hamburghammer/dchat/web"
|
||||||
TITLE="dchat-web"
|
TITLE="dchat-web"
|
||||||
DESCRIPTION="A web API and UI for the dchat-bot configuration"
|
DESCRIPTION="A web API and UI for the dchat-bot configuration"
|
||||||
|
DOCKER_BUILD_ARGS="--target web"
|
||||||
build
|
build
|
||||||
cd ..
|
|
||||||
|
|
||||||
echo "start building migration"
|
echo "start building migration"
|
||||||
cd "./migration" || exit 1
|
|
||||||
REPO="git.hhhammer.de/hamburghammer/dchat/migration"
|
REPO="git.hhhammer.de/hamburghammer/dchat/migration"
|
||||||
TITLE="dchat-migration"
|
TITLE="dchat-migration"
|
||||||
DESCRIPTION="A migration tool for the dchat database"
|
DESCRIPTION="A migration tool for the dchat database"
|
||||||
|
DOCKER_BUILD_ARGS="--target migration"
|
||||||
build
|
build
|
||||||
cd ..
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
*
|
|
||||||
!Caddyfile
|
|
||||||
!package*.json
|
|
||||||
!postcss.config.js
|
|
||||||
!tailwind.config.js
|
|
||||||
!env.d..ts
|
|
||||||
!vite.config.ts
|
|
||||||
!tsconfig.json
|
|
||||||
!tsconfig.node.json
|
|
||||||
!index.html
|
|
||||||
!public/
|
|
||||||
!src/
|
|
|
@ -1,11 +0,0 @@
|
||||||
{$SITE_ADDRESS} {
|
|
||||||
basicauth * {
|
|
||||||
{$AUTH_PASSWORD} {$AUTH_PASSWORD}
|
|
||||||
}
|
|
||||||
|
|
||||||
encode zstd gzip
|
|
||||||
|
|
||||||
root * /app
|
|
||||||
try_files {path} /index.html
|
|
||||||
file_server
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
FROM docker.io/node:18-slim AS build
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./package* .
|
|
||||||
RUN npm ci
|
|
||||||
COPY . .
|
|
||||||
RUN npm run build-only
|
|
||||||
|
|
||||||
FROM docker.io/caddy:2-alpine
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./Caddyfile /
|
|
||||||
COPY --from=build /app/dist /app
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
CMD ["caddy", "run", "--config", "/Caddyfile"]
|
|
Loading…
Reference in a new issue