-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-local.sh
executable file
·49 lines (36 loc) · 1.27 KB
/
build-local.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
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
#
# Step 1: set repos name.
#
#REPOS_NAME=jc5x/test-repository
REPOS_NAME=jc5x/test-repository
PLATFORMS=linux/amd64
VERSION="${VERSION:-develop}"
IMPORTER="${IMPORTER:-csv}"
APACHE_PLATFORM="${APACHE_PLATFORM:-7.4}"
#
# Step 2: echo some info
#
echo "build-travis.sh v1.2 (2021-01-20): I am building '${VERSION}' for ${REPOS_NAME} (${IMPORTER})."
# new script start
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes i
docker buildx create --name firefly_iii_builder
docker buildx inspect firefly_iii_builder --bootstrap
docker buildx use firefly_iii_builder
# always also push same label as the version (ie develop)
LABEL=$VERSION
# if the version is an alpha version, push to "alpha":
if [[ $VERSION == *"alpha"* ]]; then
LABEL="alpha"
fi
# if the version is a beta version, push to "beta":
if [[ $VERSION == *"beta"* ]]; then
LABEL="beta"
fi
if [[ $VERSION != *"beta"* && $VERSION != *"alpha"* && $VERSION != *"develop"* ]]; then
LABEL="latest"
fi
echo "Version is '$VERSION' so label will be '$REPOS_NAME:$LABEL'."
# build CSV
docker buildx build --build-arg version=$VERSION --build-arg apache_platform=$APACHE_PLATFORM --build-arg importer=$IMPORTER --platform $PLATFORMS -t $REPOS_NAME:$VERSION --push . -f Dockerfile
echo "Done!"