forked from apache/apisix-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
69 lines (47 loc) · 2.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# 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.
#
FROM alpine:latest as pre-build
ARG APISIX_DASHBOARD_VERSION=master
RUN set -x \
&& apk add --no-cache --virtual .builddeps git \
&& git clone https://github.com/apache/apisix-dashboard.git -b ${APISIX_DASHBOARD_VERSION} /usr/local/apisix-dashboard \
&& cd /usr/local/apisix-dashboard && git clean -Xdf \
&& rm -f ./.githash && git log --pretty=format:"%h" -1 > ./.githash
FROM golang:1.19 as api-builder
ARG ENABLE_PROXY=false
WORKDIR /usr/local/apisix-dashboard
COPY --from=pre-build /usr/local/apisix-dashboard .
RUN if [ "$ENABLE_PROXY" = "true" ] ; then go env -w GOPROXY=https://goproxy.io,direct ; fi \
&& go env -w GO111MODULE=on \
&& CGO_ENABLED=0 ./api/build.sh
FROM node:16-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.npmmirror.com/ ; fi \
&& yarn install \
&& yarn build
FROM alpine:latest as prod
ARG ENABLE_PROXY=false
RUN if [ "$ENABLE_PROXY" = "true" ] ; then sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories ; fi
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
CMD [ "/usr/local/apisix-dashboard/manager-api" ]