-
-
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.
Signed-off-by: Artur Troian <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
4 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
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
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,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
buildArgs= | ||
|
||
if [[ ! -z "$1" ]]; then | ||
buildArgs="-t $1" | ||
fi | ||
|
||
docker build -f ./local.Dockerfile ${buildArgs} . | ||
|
||
echo "removing intermediate container" | ||
docker rmi -f $(docker images -q --filter label=stage=intermediate) |
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,61 @@ | ||
FROM golang:1.13.4 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 \ | ||
GO111MODULE=on | ||
|
||
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 | ||
|
||
COPY . $GOPATH/src/github.com/VolantMQ/volantmq | ||
|
||
# build server | ||
RUN \ | ||
cd $GOPATH/src/github.com/VolantMQ/volantmq/cmd/volantmq \ | ||
&& go build $VOLANTMQ_BUILD_FLAGS -o $VOLANTMQ_WORK_DIR/bin/volantmq | ||
|
||
# build debug plugins | ||
RUN \ | ||
GO111MODULE=off go get gitlab.com/VolantMQ/vlplugin/debug \ | ||
&& cd $GOPATH/src/gitlab.com/VolantMQ/vlplugin/debug \ | ||
&& GO111MODULE=on go mod tidy \ | ||
&& go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/debug.so | ||
|
||
# build health plugins | ||
RUN \ | ||
GO111MODULE=off go get gitlab.com/VolantMQ/vlplugin/health \ | ||
&& cd $GOPATH/src/gitlab.com/VolantMQ/vlplugin/health \ | ||
&& GO111MODULE=on go mod tidy \ | ||
&& go build $VOLANTMQ_BUILD_FLAGS -buildmode=plugin -o $VOLANTMQ_WORK_DIR/plugins/health.so | ||
|
||
#build persistence plugins | ||
RUN \ | ||
GO111MODULE=off go get gitlab.com/VolantMQ/vlplugin/persistence/bbolt \ | ||
&& cd $GOPATH/src/gitlab.com/VolantMQ/vlplugin/persistence/bbolt \ | ||
&& GO111MODULE=on go mod tidy \ | ||
&& cd 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"] |