Dockerfile.centos 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. ARG BUILDPLATFORM=amd64
  18. FROM --platform=$BUILDPLATFORM alpine:latest as pre-build
  19. ARG APISIX_DASHBOARD_TAG=v3.0.0
  20. RUN set -x \
  21. && apk add --no-cache --virtual .builddeps git \
  22. && git clone https://github.com/apache/apisix-dashboard.git -b ${APISIX_DASHBOARD_TAG} /usr/local/apisix-dashboard \
  23. && cd /usr/local/apisix-dashboard && git clean -Xdf \
  24. && rm -f ./.githash && git log --pretty=format:"%h" -1 > ./.githash
  25. FROM --platform=$BUILDPLATFORM golang:1.19 as api-builder
  26. ARG ENABLE_PROXY=false
  27. WORKDIR /usr/local/apisix-dashboard
  28. COPY --from=pre-build /usr/local/apisix-dashboard .
  29. ARG TARGETOS
  30. ARG TARGETARCH
  31. RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi \
  32. && go env -w GO111MODULE=on \
  33. && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} ./api/build.sh
  34. FROM --platform=$BUILDPLATFORM node:14-alpine as fe-builder
  35. ARG ENABLE_PROXY=false
  36. WORKDIR /usr/local/apisix-dashboard
  37. COPY --from=pre-build /usr/local/apisix-dashboard .
  38. WORKDIR /usr/local/apisix-dashboard/web
  39. RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set registry https://registry.npm.taobao.org/ ; fi \
  40. && yarn install \
  41. && yarn build
  42. FROM centos:8 as prod
  43. WORKDIR /usr/local/apisix-dashboard
  44. COPY --from=api-builder /usr/local/apisix-dashboard/output/ ./
  45. COPY --from=fe-builder /usr/local/apisix-dashboard/output/ ./
  46. RUN mkdir logs
  47. EXPOSE 9000
  48. ENTRYPOINT [ "/usr/local/apisix-dashboard/manager-api" ]