dgiot/deploy/docker/Dockerfile

82 lines
2.2 KiB
Docker
Raw Normal View History

2021-05-18 14:54:48 +08:00
ARG BUILD_FROM=emqx/build-env:erl23.2.7.2-emqx-2-alpine-amd64
ARG RUN_FROM=alpine:3.12
2021-02-23 13:49:34 +08:00
FROM ${BUILD_FROM} AS builder
ARG QEMU_ARCH=x86_64
2021-05-18 14:54:48 +08:00
COPY tmp/qemu-$QEMU_ARCH-stati* /usr/bin/
2021-02-23 13:49:34 +08:00
2021-05-18 14:54:48 +08:00
RUN apk add --no-cache \
git \
2021-02-23 13:49:34 +08:00
curl \
gcc \
2021-05-14 07:28:48 +08:00
g++ \
2021-02-23 13:49:34 +08:00
make \
perl \
ncurses-dev \
openssl-dev \
coreutils \
bsd-compat-headers \
2021-05-14 07:28:48 +08:00
libc-dev \
2021-05-18 14:54:48 +08:00
libstdc++ \
bash \
jq
2021-02-23 13:49:34 +08:00
2021-05-18 14:54:48 +08:00
COPY . /emqx
ARG PKG_VSN
2021-02-23 13:49:34 +08:00
ARG EMQX_NAME=emqx
2021-05-18 14:54:48 +08:00
RUN cd /emqx && make $EMQX_NAME
2021-02-23 13:49:34 +08:00
FROM $RUN_FROM
# Basic build-time metadata as defined at http://label-schema.org
LABEL org.label-schema.docker.dockerfile="Dockerfile" \
org.label-schema.license="GNU" \
org.label-schema.name="emqx" \
2021-05-18 14:54:48 +08:00
org.label-schema.version=${PKG_VSN} \
2021-02-23 13:49:34 +08:00
org.label-schema.description="EMQ (Erlang MQTT Broker) is a distributed, massively scalable, highly extensible MQTT messaging broker written in Erlang/OTP." \
2021-05-18 14:54:48 +08:00
org.label-schema.url="https://emqx.io" \
2021-02-23 13:49:34 +08:00
org.label-schema.vcs-type="Git" \
2021-05-18 14:54:48 +08:00
org.label-schema.vcs-url="https://github.com/emqx/emqx" \
2021-02-23 13:49:34 +08:00
maintainer="Raymond M Mouthaan <raymondmmouthaan@gmail.com>, Huang Rui <vowstar@gmail.com>, EMQ X Team <support@emqx.io>"
ARG QEMU_ARCH=x86_64
2021-05-18 14:54:48 +08:00
ARG EMQX_NAME=emqx
COPY deploy/docker/docker-entrypoint.sh tmp/qemu-$QEMU_ARCH-stati* /usr/bin/
COPY --from=builder /emqx/_build/$EMQX_NAME/rel/emqx /opt/emqx
2021-02-23 13:49:34 +08:00
2021-05-18 14:54:48 +08:00
RUN ln -s /opt/emqx/bin/* /usr/local/bin/
RUN apk add --no-cache curl ncurses-libs openssl sudo libstdc++ bash
2021-02-23 13:49:34 +08:00
WORKDIR /opt/emqx
RUN adduser -D -u 1000 emqx \
&& echo "emqx ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
RUN chgrp -Rf emqx /opt/emqx && chmod -Rf g+w /opt/emqx \
2021-05-18 14:54:48 +08:00
&& chown -Rf emqx /opt/emqx
2021-02-23 13:49:34 +08:00
USER emqx
2021-05-18 14:54:48 +08:00
VOLUME ["/opt/emqx/log", "/opt/emqx/data", "/opt/emqx/etc"]
2021-02-23 13:49:34 +08:00
# emqx will occupy these port:
# - 1883 port for MQTT
2021-05-14 07:28:48 +08:00
# - 8081 for mgmt API
2021-02-23 13:49:34 +08:00
# - 8083 for WebSocket/HTTP
# - 8084 for WSS/HTTPS
# - 8883 port for MQTT(SSL)
# - 11883 port for internal MQTT/TCP
# - 18083 for dashboard
2021-05-18 14:54:48 +08:00
# - 4369 epmd (Erlang-distrbution port mapper daemon) listener (deprecated)
# - 4370 default Erlang distrbution port
2021-02-23 13:49:34 +08:00
# - 5369 for gen_rpc port mapping
2021-05-18 14:54:48 +08:00
# - 6369 6370 for distributed node
EXPOSE 1883 8081 8083 8084 8883 11883 18083 4369 4370 5369 6369 6370
2021-02-23 13:49:34 +08:00
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
2021-05-18 14:54:48 +08:00
CMD ["/opt/emqx/bin/emqx", "foreground"]