Dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. FROM node:18.3.0 as builder
  2. ADD package*.json /opt/ui/
  3. WORKDIR /opt/ui
  4. RUN npm install
  5. ADD src /opt/ui/src
  6. RUN npx parcel build src/index.html
  7. FROM nginx:alpine
  8. LABEL org.opencontainers.image.description="Cross-cloud cost allocation models for Kubernetes workloads"
  9. LABEL org.opencontainers.image.documentation=https://opencost.io/docs/
  10. LABEL org.opencontainers.image.licenses=Apache-2.0
  11. LABEL org.opencontainers.image.source=https://github.com/opencost/opencost
  12. LABEL org.opencontainers.image.title=opencost-ui
  13. LABEL org.opencontainers.image.url=https://opencost.io
  14. ARG version=dev
  15. ARG commit=HEAD
  16. ENV VERSION=${version}
  17. ENV HEAD=${commit}
  18. ENV API_PORT=9003
  19. ENV API_SERVER=0.0.0.0
  20. ENV UI_PORT=9090
  21. COPY --from=builder /opt/ui/dist /opt/ui/dist
  22. RUN mkdir -p /var/www
  23. COPY THIRD_PARTY_LICENSES.txt /THIRD_PARTY_LICENSES.txt
  24. COPY --from=builder /opt/ui/dist /var/www
  25. COPY default.nginx.conf.template /etc/nginx/conf.d/default.nginx.conf.template
  26. COPY nginx.conf /etc/nginx/
  27. COPY ./docker-entrypoint.sh /usr/local/bin/
  28. RUN rm -rf /etc/nginx/conf.d/default.conf
  29. RUN adduser 1001 -g 1000 -D
  30. RUN chown 1001:1000 -R /var/www
  31. RUN chown 1001:1000 -R /etc/nginx
  32. RUN chown 1001:1000 -R /usr/local/bin/docker-entrypoint.sh
  33. ENV BASE_URL=/model
  34. USER 1001
  35. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  36. CMD ["nginx", "-g", "daemon off;"]