Dateien für docker image build & push angelegt
This commit is contained in:
3
quarkus-automaton/.vscode/settings.json
vendored
3
quarkus-automaton/.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"java.configuration.updateBuildConfiguration": "disabled"
|
||||
"java.configuration.updateBuildConfiguration": "disabled",
|
||||
"java.compile.nullAnalysis.mode": "disabled"
|
||||
}
|
||||
17
quarkus-automaton/Dockerfile
Normal file
17
quarkus-automaton/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build-Stage: Maven-Build
|
||||
# ---------------------------------------------------------------------------
|
||||
FROM eclipse-temurin:25-jdk AS builder
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN ./mvnw package -DskipTests --no-transfer-progress
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Runtime-Stage: Minimales JRE-Image
|
||||
# ---------------------------------------------------------------------------
|
||||
FROM eclipse-temurin:25-jre
|
||||
WORKDIR /app
|
||||
COPY --from=builder /build/target/quarkus-app/ ./
|
||||
EXPOSE 8080
|
||||
USER 1000
|
||||
ENTRYPOINT ["java", "-jar", "quarkus-run.jar"]
|
||||
10
quarkus-automaton/docker/.env-example
Normal file
10
quarkus-automaton/docker/.env-example
Normal file
@@ -0,0 +1,10 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Build- und Deploy-Konfiguration (keine Secrets — kann committet werden)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
REGISTRY=ocir.eu-frankfurt-1.oci.oraclecloud.com/frhqaxi5sgcg
|
||||
IMAGE_NAME=container/automaton
|
||||
IMAGE_TAG=1.0.0
|
||||
|
||||
REGISTRY_USER=frhqaxi5sgcg/<your username> # frhqaxi5sgcg is the tenancy ID
|
||||
REGISTRY_PW=<your users auth token>
|
||||
17
quarkus-automaton/docker/README.md
Normal file
17
quarkus-automaton/docker/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Docker build (for arm nodes using qemu)
|
||||
|
||||
- Install docker CLI https://daniel.es/blog/how-to-install-docker-in-wsl-without-docker-desktop/
|
||||
- For reference: Guide for setting up multiarch build support: https://docs.docker.com/build/building/multi-platform/
|
||||
- Configure qemu emulation for arm on x86_64:
|
||||
- docker buildx create --name multi-arch-builder --use
|
||||
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
- docker buildx inspect --bootstrap
|
||||
- Before building and pushing: Copy the .env-example file to .env and enter auth info inside it
|
||||
- run ./build.sh (executes docker buildx build command to build an image on a x86 host that can run on an arm node, e.g.:
|
||||
docker buildx build --platform linux/arm64 --load -t $IMAGE . --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy)
|
||||
Multiarch images cannot be loaded into the deamon using --load but need to be pushed into a registry directly using --push or be exported to a file
|
||||
|
||||
# Docker push image to OCI
|
||||
|
||||
|
||||
- run .
|
||||
20
quarkus-automaton/docker/build.sh
Normal file
20
quarkus-automaton/docker/build.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
source "${SCRIPT_DIR}/.env"
|
||||
|
||||
IMAGE="${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
|
||||
echo "=== Image bauen & pushen: ${IMAGE} ==="
|
||||
docker login -u $REGISTRY_USER -p $REGISTRY_PW https://$REGISTRY
|
||||
docker buildx build \
|
||||
--platform linux/arm64,linux/amd64 \
|
||||
--push \
|
||||
-t $IMAGE \
|
||||
"${SCRIPT_DIR}/.."
|
||||
# in case you use a proxy:
|
||||
#--build-arg http_proxy=$http_proxy \
|
||||
#--build-arg https_proxy=$https_proxy \
|
||||
#--build-arg no_proxy=$no_proxy \
|
||||
echo "Fertig: ${IMAGE}"
|
||||
Reference in New Issue
Block a user