Skip to content

How to make a local docker build? #2222

@matthijskooijman

Description

@matthijskooijman

I'm trying to build the (docker container for) FROST-Server locally, but am have not been able to so far. I've jumped a few hoops, but not working yet. Because I do not have a local java/maven setup (and maven seems to be missing from Ubuntu by now), I'm trying to run maven (and the build) in docker, which seems to work, but at some point the build fails.

Do you have any working setup you use for local builds that you can share?

This is what I've been trying now:

❯ cat maven-in-docker 
#!/bin/sh

exec docker run -it --rm --name maven-frost -v "$(pwd)":/usr/src/mymaven -v "$(pwd)/maven-m2-dir":/root/.m2  -w /usr/src/mymaven maven:3-sapmachine-21 mvn "$@"

❯ cat docker-build 
#!/bin/sh -e

# Below is based on the maven-deploy.yml github workflow 

alias mvn=./maven-in-docker

mvn -B deploy -P release -Dgpg.skip

export HTTP_NAME=$(mvn -pl FROST-Server.HTTP -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
export MQTTP_NAME=$(mvn -pl FROST-Server.MQTTP -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
export MQTT_NAME=$(mvn -pl FROST-Server.MQTT -Dexec.executable='echo' -Dexec.args='${project.build.finalName}' exec:exec -q)
export HTTP_ARTIFACT=${HTTP_NAME}.war
export MQTTP_ARTIFACT=${MQTTP_NAME}.war
export MQTT_ARTIFACT=${MQTT_NAME}-jar-with-dependencies.jar

ARTIFACT_FILE=$MQTTP_ARTIFACT docker build -f FROST-Server.MQTTP -t fraunhoferiosb/frost-server:local

But the maven deploy fails with a ton of errors (though it seems to be errors during test, maybe I can skip tests...).

The reason for wanting this was originally to take a stab at fixing #2142, but I just noticed that was already fixed in 2.7.0-snapshot, so I can actually go ahead and just a ready-built image for now (but I suspect I might be running into other issues to debug/fix later, so having a working build setup would be nice).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions