forked from VolantMQ/volantmq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal.Dockerfile
61 lines (48 loc) · 1.82 KB
/
local.Dockerfile
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
50
51
52
53
54
55
56
57
58
59
60
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"]