Ekko Chang | 5919a14 | 2019-05-13 18:41:30 +0800 | [diff] [blame] | 1 | FROM node:alpine AS builder |
| 2 | MAINTAINER Ekko Chang <ekko.chang@qct.io> |
| 3 | |
| 4 | LABEL org.label-schema.docker.build="docker build -t dl-admin . --no-cache" \ |
| 5 | org.label-schema.docker.run="docker run -p 80:80 --add-host=dl_feeder:your_feeder_ipaddress dl-admin" |
| 6 | |
| 7 | WORKDIR /app |
| 8 | COPY ./src . |
| 9 | COPY ./nginx . |
| 10 | RUN npm install && \ |
| 11 | npm run build |
| 12 | |
| 13 | |
Kate Hsuan | a4def1d | 2020-03-17 03:46:32 +0000 | [diff] [blame] | 14 | FROM nginx:1.17.9 |
Ekko Chang | 5919a14 | 2019-05-13 18:41:30 +0800 | [diff] [blame] | 15 | RUN apt-get update && \ |
Kate Hsuan | a4def1d | 2020-03-17 03:46:32 +0000 | [diff] [blame] | 16 | apt-get install -y dnsmasq |
Ekko Chang | 5919a14 | 2019-05-13 18:41:30 +0800 | [diff] [blame] | 17 | |
| 18 | RUN echo "\n\n# Docker extra config \nuser=root\naddn-hosts=/etc/hosts\n" >> /etc/dnsmasq.conf |
| 19 | |
| 20 | COPY --from=builder /app/dist/* /usr/share/nginx/html/ |
| 21 | COPY --from=builder /app/dl-admin-nginx.conf /etc/nginx/conf.d/default.conf |
| 22 | |
Kate Hsuan | a4def1d | 2020-03-17 03:46:32 +0000 | [diff] [blame] | 23 | CMD echo "domain-needed" >> /etc/dnsmasq.conf && \ |
| 24 | echo "resolv-file=/etc/resolv.conf" >> /etc/dnsmasq.conf && \ |
| 25 | echo "expand-hosts" >> /etc/dnsmasq.conf && \ |
| 26 | echo "listen-address=127.0.0.1" >> /etc/dnsmasq.conf && \ |
| 27 | service dnsmasq restart && \ |
| 28 | echo set \$upstreamName http://dl-feeder.`grep search /etc/resolv.conf | awk {'print $2'}`:1680/datalake/v1\$1\$is_args\$args\; > /etc/nginx/upstream.conf && \ |
| 29 | nginx -g "daemon off;" |
| 30 | |
| 31 | #CMD ["sh", "-c", "tail -f /dev/null"] |