Dockerfile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Copyright 2021 EMQ Technologies Co., Ltd.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ARG GO_VERSION=1.18.5
  15. FROM ghcr.io/lf-edge/ekuiper/base:$GO_VERSION-alpine AS builder
  16. COPY . /go/kuiper
  17. WORKDIR /go/kuiper
  18. RUN make build_with_edgex
  19. FROM alpine:3.16
  20. # Set environment vars
  21. ENV MAINTAINER="emqx.io" \
  22. KUIPER_HOME="/kuiper" \
  23. KUIPER__BASIC__CONSOLELOG=true
  24. # These vars are not persisted in the final image layer
  25. ARG KUIPER_USER="kuiper"
  26. ARG KUIPER_USER_ID="1001"
  27. # (root) Add packages and "kuiper" user
  28. RUN apk add sed libzmq
  29. WORKDIR ${KUIPER_HOME}
  30. # Set appropriate ownership to allow binary full access to KUIPER_HOME dir
  31. RUN adduser -DH -s /sbin/nologin -u ${KUIPER_USER_ID} ${KUIPER_USER} && \
  32. chown -Rh ${KUIPER_USER}:${KUIPER_USER} ${KUIPER_HOME} && \
  33. mkdir -p /usr/local/taos && \
  34. chown -Rh ${KUIPER_USER}:${KUIPER_USER} /usr/local/taos
  35. # Run the kuiper process under the kuiper user
  36. USER ${KUIPER_USER}
  37. COPY --chown=${KUIPER_USER}:${KUIPER_USER} ./deploy/docker/docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
  38. COPY --chown=${KUIPER_USER}:${KUIPER_USER} --from=builder /go/kuiper/_build/kuiper-* /kuiper/
  39. VOLUME ["${KUIPER_HOME}/etc", "${KUIPER_HOME}/data", "${KUIPER_HOME}/plugins", "${KUIPER_HOME}/log"]
  40. EXPOSE 9081 20498
  41. ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
  42. CMD ["./bin/kuiperd"]