2
0

Dockerfile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. FROM golang:1.19 AS build-env
  18. WORKDIR /go/src/github.com/apisix/manager-api
  19. COPY ./ ./
  20. RUN mkdir -p /go/manager-api/conf \
  21. && go test -c -cover -covermode=atomic -o /go/manager-api/manager-api -coverpkg "./..." ./ \
  22. && mv /go/src/github.com/apisix/manager-api/entry.sh /go/manager-api/ \
  23. && mv /go/src/github.com/apisix/manager-api/conf/conf.yaml /go/manager-api/conf/conf.yaml \
  24. && mv /go/src/github.com/apisix/manager-api/conf/schema.json /go/manager-api/conf/schema.json \
  25. && mv /go/src/github.com/apisix/manager-api/conf/customize_schema.json /go/manager-api/conf/customize_schema.json \
  26. && rm -rf /go/src/github.com/apisix/manager-api \
  27. && rm -rf /etc/localtime \
  28. && ln -s /usr/share/zoneinfo/Hongkong /etc/localtime \
  29. && dpkg-reconfigure -f noninteractive tzdata
  30. RUN wget https://github.com/api7/dag-to-lua/archive/v1.1.tar.gz \
  31. && tar -zxvf v1.1.tar.gz \
  32. && mkdir -p /go/manager-api/dag-to-lua \
  33. && mv -u ./dag-to-lua-1.1/lib/* /go/manager-api/dag-to-lua/
  34. FROM alpine:3.11
  35. RUN mkdir -p /go/manager-api \
  36. && apk update \
  37. && apk add ca-certificates \
  38. && update-ca-certificates \
  39. && apk add --no-cache libc6-compat \
  40. && echo "hosts: files dns" > /etc/nsswitch.conf \
  41. && rm -rf /var/cache/apk/*
  42. WORKDIR /go/manager-api
  43. COPY --from=build-env /go/manager-api/ /go/manager-api/
  44. COPY --from=build-env /usr/share/zoneinfo/Hongkong /etc/localtime
  45. RUN mkdir logs
  46. EXPOSE 9000
  47. RUN chmod +x ./entry.sh
  48. ENTRYPOINT ["/go/manager-api/manager-api"]
  49. CMD ["-test.coverprofile=./testdata/integrationcover.out"]