-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildx.sh
executable file
·37 lines (33 loc) · 1.07 KB
/
buildx.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
#
# This script builds skuld for Intel and multiple Arm processors, using
# docker buildx cross compilers. To build the latest skuld release, do:
#
# 1. Update the VERSION variable, to build the tagged version from git.
# 2. Run: docker login deepimpact
# 3. Run: ./buildx.sh
#
# That's it!
USER=deepimpact
REPO=skuld
VERSION=v0.7.5
IMAGE=${REPO}
BUILDER_CONTAINER_NAME=${REPO}-docker-builder
PLATFORM="linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6"
# Update the version in the compile script.
sed -i "s/^VERSION=.*/VERSION=${VERSION}/g" build/compile.sh
# Create the builder container if it doesn't exist
if [[ $(docker container ls -a | grep ${BUILDER_CONTAINER_NAME} | wc -l) -eq 1 ]]; then
echo "Builder container exists, skipping creation."
else
docker buildx create --name ${BUILDER_CONTAINER_NAME}
docker buildx use ${BUILDER_CONTAINER_NAME}
docker buildx inspect --bootstrap
fi
# Build and push the images
docker buildx build --platform=${PLATFORM} \
--tag ${USER}/${IMAGE}:${VERSION} \
--tag ${USER}/${IMAGE}:latest \
-f Dockerfile \
--push \
.