Compare commits

...

4 commits

Author SHA1 Message Date
ca6a913578 container: Add .dockerignore
Some checks failed
ci/woodpecker/push/build-amd64 Pipeline was successful
ci/woodpecker/push/build-arm Pipeline failed
We will use Docker as builder in the CI for now and Docker doesn't
understand .containerignore files...
2023-07-18 00:35:32 +02:00
e56e9d0ee3 ci: Change to docker plugin to build multi platform image 2023-07-18 00:34:36 +02:00
f7e8b2356f container: Switch from alpine to jammy as final base image
Eclipse doesn't provide arm64 builds of the alpine base image.
2023-07-17 00:39:32 +02:00
1a432e9f3d container: Further reduce build output 2023-07-17 00:38:59 +02:00
4 changed files with 78 additions and 14 deletions

13
.dockerignore Normal file
View 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

View file

@ -11,5 +11,29 @@ pipeline:
from_secret: docker_token
dockerfile: Containerfile
target: bot
repo: git.hhhammer.de/hamburghammer/flyclt-deploy
repo: git.hhhammer.de/hamburghammer/dchat/bot
tags: latest
build-web-amd64:
image: plugins/docker
settings:
registry: git.hhhammer.de
username: ci
password:
from_secret: docker_token
dockerfile: Containerfile
target: web
repo: git.hhhammer.de/hamburghammer/dchat/web
tags: latest
build-migration-amd64:
image: plugins/docker
settings:
registry: git.hhhammer.de
username: ci
password:
from_secret: docker_token
dockerfile: Containerfile
target: migration
repo: git.hhhammer.de/hamburghammer/dchat/migration
tags: latest

View file

@ -1,8 +1,8 @@
platform: linux/arm*
platform: linux/amd64
# branch: main
pipeline:
build-bot-arm:
build-bot-arm64:
image: plugins/docker
settings:
registry: git.hhhammer.de
@ -11,5 +11,32 @@ pipeline:
from_secret: docker_token
dockerfile: Containerfile
target: bot
repo: git.hhhammer.de/hamburghammer/flyclt-deploy
repo: git.hhhammer.de/hamburghammer/dchat/bot
tags: latest
platform: linux/arm64
build-web-arm64:
image: plugins/docker
settings:
registry: git.hhhammer.de
username: ci
password:
from_secret: docker_token
dockerfile: Containerfile
target: web
repo: git.hhhammer.de/hamburghammer/dchat/web
tags: latest
platform: linux/arm64
build-migration-arm64:
image: plugins/docker
settings:
registry: git.hhhammer.de
username: ci
password:
from_secret: docker_token
dockerfile: Containerfile
target: migration
repo: git.hhhammer.de/hamburghammer/dchat/migration
tags: latest
platform: linux/arm64

View file

@ -9,39 +9,39 @@ COPY migration/pom.xml migration/
COPY web/pom.xml web/
# Adding default Maven arguments
ENV MAVEN_CLI_OPTS="--batch-mode"
ENV MAVEN_CLI_OPTS="--batch-mode --no-transfer-progress"
# Resolve dependencies for shared libraries
RUN mvn -pl db -am dependency:go-offline
RUN 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.
COPY db db
RUN mvn -pl db -am install
RUN mvn $MAVEN_CLI_OPTS -pl db -am install
# Resolve dependencies for modules without dependencies to each other
RUN mvn dependency:go-offline
RUN mvn $MAVEN_CLI_OPTS dependency:go-offline
# Build modules
COPY web web
RUN mvn -pl web package
RUN mvn $MAVEN_CLI_OPTS -pl web package
COPY bot bot
RUN mvn -pl bot package
RUN mvn $MAVEN_CLI_OPTS -pl bot package
COPY migration migration
RUN mvn -pl migration package
RUN mvn $MAVEN_CLI_OPTS -pl migration package
# Stage 2: Create final web
FROM docker.io/eclipse-temurin:19-jdk-alpine AS web
FROM docker.io/eclipse-temurin:19-jdk-jammy 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
FROM docker.io/eclipse-temurin:19-jdk-jammy 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
FROM docker.io/eclipse-temurin:19-jdk-jammy AS bot
WORKDIR /app
COPY --from=maven /app/bot/target/bot-*-fat.jar /app/bot.jar
CMD ["java", "-jar", "/app/bot.jar"]