-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing automated builds on Dockerhub for multi-arch.
- Loading branch information
Showing
9 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
FROM golang:1.11.1 as builder | ||
LABEL stage=intermediate | ||
|
||
COPY qemu-aarch64-static /usr/bin/ | ||
|
||
#compile linux only | ||
|
||
ENV \ | ||
GOOS=linux \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq \ | ||
VOLANTMQ_BUILD_FLAGS="-i" \ | ||
VOLANTMQ_PLUGINS_DIR=/usr/lib/volantmq/plugins | ||
|
||
RUN mkdir -p $VOLANTMQ_WORK_DIR/bin | ||
RUN mkdir -p $VOLANTMQ_WORK_DIR/conf | ||
RUN mkdir -p $VOLANTMQ_PLUGINS_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
|
||
# install dep tool | ||
RUN go get -u github.com/golang/dep/cmd/dep | ||
|
||
# build server | ||
RUN \ | ||
go get -v github.com/ahmetb/govvv && \ | ||
go get -v github.com/VolantMQ/vlapi/... && \ | ||
go get -v github.com/VolantMQ/volantmq && \ | ||
cd $GOPATH/src/github.com/VolantMQ/volantmq && \ | ||
govvv build $VOLANTMQ_BUILD_FLAGS -o $VOLANTMQ_WORK_DIR/bin/volantmq | ||
|
||
# build debug plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/debug && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/debug.so | ||
|
||
# build health plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/health && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/health.so | ||
|
||
#build persistence plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/persistence/bbolt/plugin && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/persistence_bbolt.so | ||
|
||
FROM ubuntu | ||
ENV \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq | ||
|
||
COPY --from=builder $VOLANTMQ_WORK_DIR $VOLANTMQ_WORK_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
ENV VOLANTMQ_PLUGINS_DIR=$VOLANTMQ_WORK_DIR/plugins | ||
|
||
# default config uses mqtt:1883 | ||
EXPOSE 1883 | ||
CMD ["volantmq"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
FROM golang:1.11.1 as builder | ||
LABEL stage=intermediate | ||
|
||
#compile linux only | ||
|
||
ENV \ | ||
GOOS=linux \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq \ | ||
VOLANTMQ_BUILD_FLAGS="-i" \ | ||
VOLANTMQ_PLUGINS_DIR=/usr/lib/volantmq/plugins | ||
|
||
RUN mkdir -p $VOLANTMQ_WORK_DIR/bin | ||
RUN mkdir -p $VOLANTMQ_WORK_DIR/conf | ||
RUN mkdir -p $VOLANTMQ_PLUGINS_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
|
||
# install dep tool | ||
RUN go get -u github.com/golang/dep/cmd/dep | ||
|
||
# build server | ||
RUN \ | ||
go get -v github.com/ahmetb/govvv && \ | ||
go get -v github.com/VolantMQ/vlapi/... && \ | ||
go get -v github.com/VolantMQ/volantmq && \ | ||
cd $GOPATH/src/github.com/VolantMQ/volantmq && \ | ||
govvv build $VOLANTMQ_BUILD_FLAGS -o $VOLANTMQ_WORK_DIR/bin/volantmq | ||
|
||
# build debug plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/debug && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/debug.so | ||
|
||
# build health plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/health && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/health.so | ||
|
||
#build persistence plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/persistence/bbolt/plugin && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/persistence_bbolt.so | ||
|
||
FROM ubuntu | ||
ENV \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq | ||
|
||
COPY --from=builder $VOLANTMQ_WORK_DIR $VOLANTMQ_WORK_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
ENV VOLANTMQ_PLUGINS_DIR=$VOLANTMQ_WORK_DIR/plugins | ||
|
||
# default config uses mqtt:1883 | ||
EXPOSE 1883 | ||
CMD ["volantmq"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
FROM golang:1.11.1 as builder | ||
LABEL stage=intermediate | ||
|
||
COPY qemu-arm-static /usr/bin/ | ||
|
||
#compile linux only | ||
|
||
ENV \ | ||
GOOS=linux \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq \ | ||
VOLANTMQ_BUILD_FLAGS="-i" \ | ||
VOLANTMQ_PLUGINS_DIR=/usr/lib/volantmq/plugins | ||
|
||
RUN mkdir -p $VOLANTMQ_WORK_DIR/bin | ||
RUN mkdir -p $VOLANTMQ_WORK_DIR/conf | ||
RUN mkdir -p $VOLANTMQ_PLUGINS_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
|
||
# install dep tool | ||
RUN go get -u github.com/golang/dep/cmd/dep | ||
|
||
# build server | ||
RUN \ | ||
go get -v github.com/ahmetb/govvv && \ | ||
go get -v github.com/VolantMQ/vlapi/... && \ | ||
go get -v github.com/VolantMQ/volantmq && \ | ||
cd $GOPATH/src/github.com/VolantMQ/volantmq && \ | ||
govvv build $VOLANTMQ_BUILD_FLAGS -o $VOLANTMQ_WORK_DIR/bin/volantmq | ||
|
||
# build debug plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/debug && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/debug.so | ||
|
||
# build health plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/health && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/health.so | ||
|
||
#build persistence plugins | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/vlapi/plugin/persistence/bbolt/plugin && \ | ||
go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/persistence_bbolt.so | ||
|
||
FROM ubuntu | ||
ENV \ | ||
VOLANTMQ_WORK_DIR=/usr/lib/volantmq | ||
|
||
COPY --from=builder $VOLANTMQ_WORK_DIR $VOLANTMQ_WORK_DIR | ||
|
||
# Create environment directory | ||
ENV PATH $VOLANTMQ_WORK_DIR/bin:$PATH | ||
ENV VOLANTMQ_PLUGINS_DIR=$VOLANTMQ_WORK_DIR/plugins | ||
|
||
# default config uses mqtt:1883 | ||
EXPOSE 1883 | ||
CMD ["volantmq"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# thanks https://stackoverflow.com/questions/54578066/how-to-build-a-docker-image-on-a-specific-architecture-with-docker-hub | ||
docker build \ | ||
--file "${DOCKERFILE_PATH}" \ | ||
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ | ||
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \ | ||
--tag "$IMAGE_NAME" \ | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2) | ||
echo $BUILD_ARCH | ||
[ "${BUILD_ARCH}" == "Dockerfile" ] && \ | ||
{ echo 'qemu-user-static: Download not required for current arch'; exit 0; } | ||
|
||
QEMU_USER_STATIC_ARCH=$([ "${BUILD_ARCH}" == "armhf" ] && echo "${BUILD_ARCH::-2}" || echo "${BUILD_ARCH}") | ||
QEMU_USER_STATIC_DOWNLOAD_URL="https://github.com/multiarch/qemu-user-static/releases/download" | ||
QEMU_USER_STATIC_LATEST_TAG=$(curl -s https://api.github.com/repos/multiarch/qemu-user-static/tags \ | ||
| grep 'name.*v[0-9]' \ | ||
| head -n 1 \ | ||
| cut -d '"' -f 4) | ||
|
||
curl -SL "${QEMU_USER_STATIC_DOWNLOAD_URL}/${QEMU_USER_STATIC_LATEST_TAG}/x86_64_qemu-${QEMU_USER_STATIC_ARCH}-static.tar.gz" \ | ||
| tar xzv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2) | ||
|
||
[ "${BUILD_ARCH}" == "Dockerfile" ] && \ | ||
{ echo 'qemu-user-static: Registration not required for current arch'; exit 0; } | ||
|
||
docker run --rm --privileged multiarch/qemu-user-static:register --reset |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/qemu-arm-static /bin/sh.real | ||
|
||
set -o errexit | ||
|
||
cp /bin/sh.real /bin/sh | ||
/bin/sh "$@" | ||
cp /usr/bin/sh-shim /bin/sh |