Compare commits
27 commits
95cb36d6ed
...
7171b8905a
Author | SHA1 | Date | |
---|---|---|---|
7171b8905a | |||
13693bf7a7 | |||
b36b087302 | |||
4b67b605f3 | |||
4762911c8c | |||
1bcc9af5ba | |||
eef6b98171 | |||
ab8b65f099 | |||
d87af982f7 | |||
aae16b0e88 | |||
b5ebeabec4 | |||
0d09f1d3b4 | |||
616bcf1f18 | |||
8f2cdf8bad | |||
2cefa95f6f | |||
1a130da1da | |||
ca6a913578 | |||
e56e9d0ee3 | |||
f7e8b2356f | |||
1a432e9f3d | |||
d4ca9336b4 | |||
1d68948c5a | |||
db07e70679 | |||
0062491b2e | |||
de18f158aa | |||
439f62c31f | |||
cb42a9b2c2 |
7 changed files with 105 additions and 52 deletions
27
.woodpecker/build.yml
Normal file
27
.woodpecker/build.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
TARGET:
|
||||||
|
- bot
|
||||||
|
- web
|
||||||
|
- migration
|
||||||
|
|
||||||
|
platform: ${platform}
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
group: build
|
||||||
|
settings:
|
||||||
|
registry: git.hhhammer.de
|
||||||
|
username: ci
|
||||||
|
password:
|
||||||
|
from_secret: docker_token
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: ${TARGET}
|
||||||
|
repo: git.hhhammer.de/hamburghammer/dchat/${TARGET}
|
||||||
|
tags: latest
|
||||||
|
pull_image: false
|
|
@ -1,43 +0,0 @@
|
||||||
# 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"]
|
|
65
Dockerfile
Normal file
65
Dockerfile
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
ARG MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress -Dmaven.test.skip"
|
||||||
|
|
||||||
|
# Copy all project files
|
||||||
|
FROM docker.io/maven:3.9-eclipse-temurin-20 AS setup
|
||||||
|
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 --mount=type=cache,target=/root/.m2/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} -pl db -am dependency:go-offline
|
||||||
|
# Install the shared libraries in the local Maven repo (`.m2`)
|
||||||
|
# This will also install the `root` module.
|
||||||
|
|
||||||
|
# Build db dependency
|
||||||
|
FROM setup AS db-build
|
||||||
|
COPY db db
|
||||||
|
RUN --mount=type=cache,target=/root/.m2/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} -pl db -am install
|
||||||
|
# Resolve dependencies for modules without dependencies to each other
|
||||||
|
RUN --mount=type=cache,target=/root/.m2/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} dependency:go-offline
|
||||||
|
|
||||||
|
# Build modules
|
||||||
|
FROM db-build AS web-build
|
||||||
|
COPY web web
|
||||||
|
RUN --mount=type=cache,target=/root/.m2/ \
|
||||||
|
--mount=type=cache,target=/app/web/src/ui/dist/ \
|
||||||
|
--mount=type=cache,target=/app/web/src/ui/node/ \
|
||||||
|
--mount=type=cache,target=/app/web/src/ui/node_modules/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} -pl web package
|
||||||
|
|
||||||
|
FROM db-build AS bot-build
|
||||||
|
COPY bot bot
|
||||||
|
RUN --mount=type=cache,target=/root/.m2/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} -pl bot package
|
||||||
|
|
||||||
|
FROM db-build AS migration-build
|
||||||
|
COPY migration migration
|
||||||
|
RUN --mount=type=cache,target=/root/.m2/ \
|
||||||
|
mvn ${MAVEN_CLI_OPTS} -pl migration package
|
||||||
|
|
||||||
|
# Create final web
|
||||||
|
FROM docker.io/eclipse-temurin:20-jdk-jammy AS web
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=web-build /app/web/target/web-*-fat.jar /app/web.jar
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["java", "-jar", "/app/web.jar"]
|
||||||
|
|
||||||
|
# Create final migration
|
||||||
|
FROM docker.io/eclipse-temurin:20-jdk-jammy AS migration
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=migration-build /app/migration/target/migration-*-fat.jar /app/migration.jar
|
||||||
|
CMD ["java", "-jar", "/app/migration.jar"]
|
||||||
|
|
||||||
|
# Create final bot
|
||||||
|
FROM docker.io/eclipse-temurin:20-jdk-jammy AS bot
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=bot-build /app/bot/target/bot-*-fat.jar /app/bot.jar
|
||||||
|
CMD ["java", "-jar", "/app/bot.jar"]
|
12
build.sh
12
build.sh
|
@ -9,10 +9,17 @@ build() {
|
||||||
REVISION=$(git rev-parse HEAD)
|
REVISION=$(git rev-parse HEAD)
|
||||||
|
|
||||||
IMAGE_LATEST="${REPO}:latest"
|
IMAGE_LATEST="${REPO}:latest"
|
||||||
|
|
||||||
|
if [ "$PUSH_LATEST" == "1" ]; then
|
||||||
|
DOCKER_BUILD_ARGS="$DOCKER_BUILD_ARGS --push"
|
||||||
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
podman build \
|
docker buildx build \
|
||||||
$DOCKER_BUILD_ARGS \
|
$DOCKER_BUILD_ARGS \
|
||||||
-t $IMAGE_LATEST \
|
-t $IMAGE_LATEST \
|
||||||
|
--file Containerfile \
|
||||||
|
--platform linux/amd64,linux/arm64 \
|
||||||
--label "org.opencontainers.image.revision=${REVISION}" \
|
--label "org.opencontainers.image.revision=${REVISION}" \
|
||||||
--label "org.opencontainers.image.version=${TAG}" \
|
--label "org.opencontainers.image.version=${TAG}" \
|
||||||
--label "org.opencontainers.image.authors=${AUTHORS}" \
|
--label "org.opencontainers.image.authors=${AUTHORS}" \
|
||||||
|
@ -23,9 +30,6 @@ build() {
|
||||||
--label "org.opencontainers.image.description=${DESCRIPTION}" \
|
--label "org.opencontainers.image.description=${DESCRIPTION}" \
|
||||||
. || exit $?
|
. || exit $?
|
||||||
|
|
||||||
if [ "$PUSH_LATEST" == "1" ]; then
|
|
||||||
podman push "${IMAGE_LATEST}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "start building bot"
|
echo "start building bot"
|
||||||
|
|
|
@ -6,7 +6,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
build:
|
build:
|
||||||
dockerfile: Containerfile
|
dockerfile: Dockerfile
|
||||||
context: .
|
context: .
|
||||||
target: bot
|
target: bot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -22,7 +22,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
build:
|
build:
|
||||||
dockerfile: Containerfile
|
dockerfile: Dockerfile
|
||||||
context: .
|
context: .
|
||||||
target: web
|
target: web
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -38,7 +38,7 @@ services:
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
build:
|
build:
|
||||||
dockerfile: Containerfile
|
dockerfile: Dockerfile
|
||||||
context: .
|
context: .
|
||||||
target: migration
|
target: migration
|
||||||
user: 1000:1000
|
user: 1000:1000
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -27,8 +27,8 @@
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>19</maven.compiler.source>
|
<maven.compiler.source>20</maven.compiler.source>
|
||||||
<maven.compiler.target>19</maven.compiler.target>
|
<maven.compiler.target>20</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<jackson.version>2.15.1</jackson.version>
|
<jackson.version>2.15.1</jackson.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
Loading…
Reference in a new issue