Dockerfile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. # This is a separate mzimage so that we don't have to re-install the apt things
  10. # every time we get a CI builder with a cold cache.
  11. # Package a pinned version of the console into the image, for ease of getting
  12. # started with Materialize. It's okay if this console lags a bit behind what's
  13. # deployed to production, but the version needs to be bumped whenever features
  14. # that the console depends upon are removed (to a version of the console that
  15. # doesn't depend on those features).
  16. FROM materialize/console:25.2.3 AS console
  17. MZFROM ubuntu-base
  18. ARG CI_SANITIZER=none
  19. RUN groupadd --system --gid=999 materialize \
  20. && useradd --system --gid=999 --uid=999 --create-home materialize \
  21. && apt-get update \
  22. && TZ=UTC DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends \
  23. ca-certificates \
  24. curl \
  25. gettext-base \
  26. nginx \
  27. postgresql \
  28. ssh \
  29. tini \
  30. && if [ "$CI_SANITIZER" != "none" ]; then \
  31. TZ=UTC DEBIAN_FRONTEND=noninteractive apt-get -qy install --no-install-recommends llvm; \
  32. fi \
  33. && rm -rf /var/lib/apt/lists/* \
  34. && apt-get clean \
  35. && mkdir -p /mzdata /scratch /var/lib/postgresql/data /var/run/postgresql /var/lib/nginx /var/log/nginx /etc/postgresql/16/main \
  36. && touch /run/nginx.pid \
  37. && chown -R materialize /mzdata /scratch /var/lib/postgresql/data /var/run/postgresql /var/log/postgresql /var/lib/postgresql/16/main /var/lib/nginx /var/log/nginx /run/nginx.pid /etc/postgresql/16/main
  38. COPY postgresql.conf pg_hba.conf /etc/postgresql/16/main/
  39. COPY --from=console /usr/share/nginx/html /usr/share/nginx/html
  40. COPY console_nginx.template /etc/nginx/templates/default.conf.template
  41. # Configure the console to listen on port 6874 and proxy API requests through to
  42. # the Materialize instance that will be started and listening for requests on
  43. # port 6876.
  44. RUN MZ_ENDPOINT=http://localhost:6876 \
  45. MZ_NGINX_LISTENER_CONFIG="listen 6874;" \
  46. envsubst '${MZ_ENDPOINT} ${MZ_NGINX_LISTENER_CONFIG}' < /etc/nginx/templates/default.conf.template > /etc/nginx/sites-enabled/default \
  47. && rm /etc/nginx/templates/default.conf.template
  48. USER materialize