Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding script building docker image from remote #4027

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions tools/build-docker-from-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

set -e

# Setting COMMIT_HASH to the value of the first parameter or to local HEAD if it was not provided
COMMIT_HASH=${1:-$(git rev-parse HEAD)}

SRC_ROOT="$(dirname "${BASH_SOURCE}")"
source $SRC_ROOT/circleci-prepare-mongooseim-docker.sh

# Build a builder image (contains erlang and the build tools)
docker build -f Dockerfile.builder -t mongooseim-builder .

# Create a volume for the result tarballs
docker volume create mongooseim-builds || echo "Probably already created volume"

# Build MongooseIM release
docker run --rm -v mongooseim-builds:/builds -e TARBALL_NAME=mongooseim mongooseim-builder /build.sh MongooseIM https://github.com/esl/MongooseIM ${COMMIT_HASH}

# Copy the latest build artifact
CID=$(docker run --rm -d -v mongooseim-builds:/builds busybox sleep 1000)
docker cp $CID:/builds/. ./member/
docker rm -f $CID

# Build a final image
docker build -f Dockerfile.member -t mongooseim .

cd ..
rm -rf mongooseim-docker