basolato.dockerfile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. FROM ubuntu:22.04 AS build
  2. # prevent timezone dialogue
  3. ENV DEBIAN_FRONTEND=noninteractive
  4. RUN apt update && \
  5. apt upgrade -y
  6. RUN apt install -y --fix-missing \
  7. gcc \
  8. xz-utils \
  9. ca-certificates \
  10. curl \
  11. git
  12. ARG VERSION="2.0.2"
  13. WORKDIR /root
  14. RUN curl https://nim-lang.org/choosenim/init.sh -o init.sh
  15. RUN sh init.sh -y
  16. RUN rm -f init.sh
  17. ENV PATH $PATH:/root/.nimble/bin
  18. RUN choosenim ${VERSION}
  19. ENV PATH $PATH:/root/.nimble/bin
  20. ADD ./ /basolato
  21. WORKDIR /basolato
  22. RUN nimble install -y
  23. RUN ducere build -p:8080 -o:speed
  24. FROM ubuntu:22.04 AS runtime
  25. # prevent timezone dialogue
  26. ENV DEBIAN_FRONTEND=noninteractive
  27. RUN apt update && \
  28. apt upgrade -y
  29. RUN apt install -y --fix-missing \
  30. xz-utils \
  31. ca-certificates \
  32. libpq-dev
  33. WORKDIR /basolato
  34. COPY --from=build /basolato/main .
  35. RUN chmod 111 main
  36. COPY --from=build /basolato/startServer.sh .
  37. RUN chmod 111 startServer.sh
  38. # Secret
  39. ENV SECRET_KEY="pZWEVzA7h2FcKLgVM3ec5Eiik7eU9Ehpf0uLdYOZDgr0uZKIo5LdQE9sjIub3IDkUTrf3X2Jsh1Uw8b02GtAfWRn4C9NptfdSyoK"
  40. # DB Connection
  41. ENV DB_DATABASE="hello_world"
  42. ENV DB_USER="benchmarkdbuser"
  43. ENV DB_PASSWORD="benchmarkdbpass"
  44. ENV DB_HOST="tfb-database"
  45. ENV DB_PORT=5432
  46. ENV DB_MAX_CONNECTION=2000
  47. ENV DB_TIMEOUT=30
  48. # Logging
  49. ENV LOG_IS_DISPLAY=false
  50. ENV LOG_IS_FILE=false
  51. ENV LOG_IS_ERROR_FILE=false
  52. # Session db
  53. # Session type, file or redis, is defined in config.nims
  54. ENV SESSION_TIME=20160
  55. ENV LOCALE=en
  56. EXPOSE 8080
  57. CMD ./startServer.sh