Dockerfile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Multi-stage Dockerfile for Spry Framework Demo Website
  2. # Build stage: Compile the Vala application
  3. FROM fedora:43 AS builder
  4. # Install build dependencies
  5. RUN dnf install -y \
  6. meson \
  7. ninja-build \
  8. gcc \
  9. vala \
  10. glib2-devel \
  11. gobject-introspection-devel \
  12. json-glib-devel \
  13. libxml2-devel \
  14. zlib-devel \
  15. libzstd-devel \
  16. libgee-devel \
  17. brotli-devel \
  18. libmicrohttpd-devel \
  19. libsodium-devel \
  20. git \
  21. pkg-config \
  22. && dnf clean all
  23. # Clone and build invercargill library
  24. WORKDIR /build
  25. RUN git clone -b expressions https://fabrica.unitatem.net/Tilo15/Invercargill.git invercargill && \
  26. cd invercargill && \
  27. meson setup src builddir --prefix=/usr && \
  28. ninja -C builddir && \
  29. ninja -C builddir install && echo hi
  30. # Clone and build invercargill-json library
  31. RUN git clone https://git.sr.ht/~tilo15/Invercargill-Json invercargill-json && \
  32. cd invercargill-json && \
  33. meson setup src builddir --prefix=/usr && \
  34. ninja -C builddir && \
  35. ninja -C builddir install
  36. # Clone and build inversion library (depends on invercargill)
  37. RUN git clone https://fabrica.unitatem.net/Tilo15/inversion.git inversion && \
  38. cd inversion && \
  39. meson setup builddir --prefix=/usr && \
  40. ninja -C builddir && \
  41. ninja -C builddir install
  42. # Clone and build astralis library (depends on invercargill, invercargill-json, inversion)
  43. RUN git clone https://fabrica.unitatem.net/Tilo15/astralis.git astralis && \
  44. cd astralis && \
  45. meson setup builddir --prefix=/usr && \
  46. ninja -C builddir && \
  47. ninja -C builddir install
  48. # Copy the Spry project source
  49. COPY . /build/spry
  50. # Build the Spry library and demo
  51. WORKDIR /build/spry
  52. RUN meson setup builddir --prefix=/usr && \
  53. ninja -C builddir && \
  54. ninja -C builddir install
  55. # Runtime stage: Minimal image with only necessary runtime libraries
  56. FROM fedora:43 AS runtime
  57. # Install runtime dependencies only
  58. RUN dnf install -y \
  59. glib2 \
  60. json-glib \
  61. libxml2 \
  62. zlib \
  63. libzstd \
  64. brotli \
  65. libmicrohttpd \
  66. libgee \
  67. libsodium \
  68. && dnf clean all
  69. # Copy built libraries and executable from builder
  70. COPY --from=builder /usr/lib64/libinvercargill*.so* /usr/lib64/
  71. COPY --from=builder /usr/lib64/libinvercargill-json*.so* /usr/lib64/
  72. COPY --from=builder /usr/lib64/libinversion*.so* /usr/lib64/
  73. COPY --from=builder /usr/lib64/libastralis*.so* /usr/lib64/
  74. COPY --from=builder /usr/lib64/libspry*.so* /usr/lib64/
  75. COPY --from=builder /usr/lib64/girepository-1.0/*.typelib /usr/lib64/girepository-1.0/
  76. COPY --from=builder /usr/bin/spry-demo /usr/bin/
  77. # Copy demo source files for DemoHostComponent to display in the demo viewer
  78. # These paths must match what DemoHostComponent.source_file expects
  79. COPY --from=builder /build/spry/demo/DemoComponents /app/demo/DemoComponents
  80. # Set working directory so relative paths in DemoHostComponent resolve correctly
  81. WORKDIR /app
  82. # Update library cache
  83. RUN ldconfig
  84. # Expose the default port
  85. EXPOSE 8080
  86. # Set environment variables
  87. ENV PORT=8080
  88. # Run the demo website
  89. CMD ["spry-demo", "8080"]