Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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://github.com/opencost/opencost
  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 THIRD_PARTY_LICENSES.txt /THIRD_PARTY_LICENSES.txt
  22. COPY --from=builder /opt/ui/dist /var/www
  23. COPY default.nginx.conf.template /etc/nginx/conf.d/default.nginx.conf.template
  24. COPY nginx.conf /etc/nginx/
  25. COPY ./docker-entrypoint.sh /usr/local/bin/
  26. RUN rm -rf /etc/nginx/conf.d/default.conf
  27. RUN adduser 1001 -g 1000 -D
  28. RUN chown 1001:1000 -R /var/www
  29. RUN chown 1001:1000 -R /etc/nginx
  30. RUN chown 1001:1000 -R /usr/local/bin/docker-entrypoint.sh
  31. ENV BASE_URL=/model
  32. USER 1001
  33. ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
  34. CMD ["nginx", "-g", "daemon off;"]