Dockerfile 1.2 KB

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