dgiot/deploy/docker/Dockerfile

73 lines
1.6 KiB
Docker
Raw Normal View History

2022-12-29 18:13:09 +08:00
ARG BUILD_FROM=ghcr.io/emqx/emqx-builder/4.4-20:24.3.4.2-1-alpine3.15.1
ARG RUN_FROM=alpine:3.15.1
2021-02-23 13:49:34 +08:00
FROM ${BUILD_FROM} AS builder
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 \
2022-12-29 18:13:09 +08:00
tzdata \
2021-05-18 14:54:48 +08:00
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
2022-12-29 18:13:09 +08:00
ENV EMQX_RELUP=false
2021-08-16 15:07:42 +08:00
RUN cd /emqx \
&& rm -rf _build/$EMQX_NAME/lib \
&& make $EMQX_NAME
2021-02-23 13:49:34 +08:00
FROM $RUN_FROM
2021-05-18 14:54:48 +08:00
ARG EMQX_NAME=emqx
2022-12-29 18:13:09 +08:00
COPY deploy/docker/docker-entrypoint.sh /usr/bin/
2021-05-18 14:54:48 +08:00
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/
2022-12-29 18:13:09 +08:00
RUN apk add --no-cache curl ncurses-libs openssl sudo libstdc++ bash tzdata
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
2022-12-29 18:13:09 +08:00
## NOTE: /opt/emqx/etc is removed from the VOLUME list since 4.3.13
VOLUME ["/opt/emqx/log", "/opt/emqx/data"]
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"]