Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit

Permalink
ARM build will now be compiled @force-rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Oct 7, 2019
1 parent 5550a05 commit d1a3f5e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 15 additions & 1 deletion Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{% if ARCH == "arm" %}
FROM golang:1.13 as builder

RUN set -x \
&& cd /opt \
&& git clone https://github.com/minio/mc -b {{ VERSION }} \
&& cd /opt/mc \
&& GOOS=linux GOARCH=arm64 go build -tags kqueue -o /usr/bin/mc \
&& test -f /usr/bin/mc
{% endif %}

FROM {{ IMAGE }}

LABEL maintainer="RiotKit" \
Expand Down Expand Up @@ -33,14 +44,17 @@ ENV SOURCE_URL=http://primary.backups.example.org \
COPY bin/*.sh /

{% if ARCH == "arm" %}
COPY --from=builder /usr/bin/mc /usr/bin/mc

RUN [ "cross-build-start" ]
{% endif %}

RUN apk add --update bash sed \
&& addgroup -g 1050 mirroring_comrade \
&& adduser -D -u 1050 -G mirroring_comrade mirroring_comrade \
&& chmod +x /*.sh \
&& chmod +x /*.sh {% if ARCH != "arm" %}\
&& /download_minio_version.sh {{ VERSION }}
{% endif %}

{% if ARCH == "arm" %}
RUN [ "cross-build-end" ]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ build_x86_64: ## Build x86-64 image (args: VERSION)
make generate_dockerfile _build ARCH=x86_64 IMAGE=alpine:3.9 VERSION=${VERSION} PUSH=${PUSH}

build_arm: ## Build ARM image (args: VERSION)
make generate_dockerfile _build ARCH=arm IMAGE=balenalib/armv7hf-alpine:3.9 VERSION=${VERSION} PUSH=${PUSH}
make generate_dockerfile _build ARCH=arm IMAGE=balenalib/aarch64-alpine:3.9 VERSION=${VERSION} PUSH=${PUSH}

_build:
${SUDO} docker build . -f ./Dockerfile -t quay.io/riotkit/riot-mc-mirror:${VERSION}-${ARCH}
Expand Down
16 changes: 16 additions & 0 deletions bin/download_minio_version.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#!/bin/bash

set -e

VERSION=$1
ARCH=$2

if [[ $ARCH == "arm" ]]; then
echo " >> Compiling form ARM"

cd /tmp
git clone https://github.com/minio/mc.git -b $VERSION
cd mc
GOOS=linux GOARCH=arm64 go build -tags kqueue -o /usr/bin/mc
chmod +x /usr/bin/mc
rm -rf /tmp/mc

exit 0
fi

echo " >> Downloading Minio Client in version '${VERSION}'"
wget "https://dl.minio.io/client/mc/release/linux-amd64/mc.${VERSION}" -O /usr/bin/mc || wget "https://dl.minio.io/client/mc/release/linux-amd64/archive/mc.${VERSION}" -O /usr/bin/mc || exit 1
Expand Down

0 comments on commit d1a3f5e

Please sign in to comment.