# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ARG BUILDPLATFORM=amd64 FROM --platform=$BUILDPLATFORM alpine:latest as pre-build ARG APISIX_DASHBOARD_TAG=v3.0.1 RUN set -x \ && apk add --no-cache --virtual .builddeps git \ && git clone https://github.com/apache/apisix-dashboard.git -b ${APISIX_DASHBOARD_TAG} /usr/local/apisix-dashboard \ && cd /usr/local/apisix-dashboard && git clean -Xdf \ && rm -f ./.githash && git log --pretty=format:"%h" -1 > ./.githash FROM --platform=$BUILDPLATFORM golang:1.19 as api-builder ARG ENABLE_PROXY=false WORKDIR /usr/local/apisix-dashboard COPY --from=pre-build /usr/local/apisix-dashboard . ARG TARGETOS ARG TARGETARCH RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi \ && go env -w GO111MODULE=on \ && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} ./api/build.sh FROM --platform=$BUILDPLATFORM node:14-alpine as fe-builder ARG ENABLE_PROXY=false WORKDIR /usr/local/apisix-dashboard COPY --from=pre-build /usr/local/apisix-dashboard . WORKDIR /usr/local/apisix-dashboard/web RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set registry https://registry.npm.taobao.org/ ; fi \ && yarn install \ && yarn build FROM centos:8 as prod WORKDIR /usr/local/apisix-dashboard COPY --from=api-builder /usr/local/apisix-dashboard/output/ ./ COPY --from=fe-builder /usr/local/apisix-dashboard/output/ ./ RUN mkdir logs EXPOSE 9000 ENTRYPOINT [ "/usr/local/apisix-dashboard/manager-api" ]