Переглянути джерело

build(docker): add Dockerfile and enable website installation

Add Dockerfile and .dockerignore for containerized website deployment.
Enable installation of spry-website executable in meson build configuration.
Billy Barrow 1 тиждень тому
батько
коміт
8963ca3f3e
4 змінених файлів з 124 додано та 1 видалено
  1. 27 0
      .dockerignore
  2. 96 0
      Dockerfile
  3. BIN
      spry-website.tar.gz
  4. 1 1
      website/meson.build

+ 27 - 0
.dockerignore

@@ -0,0 +1,27 @@
+# Build directory
+builddir/
+
+# Git
+.git/
+.gitignore
+
+# IDE/Editor files
+.vscode/
+.idea/
+*.swp
+*.swo
+*~
+
+# Documentation
+*.md
+!README.md
+
+# VAPI files (not needed at runtime, only build)
+vapi/
+
+# Any compiled objects
+*.o
+*.a
+
+# Test files
+tests/

+ 96 - 0
Dockerfile

@@ -0,0 +1,96 @@
+# Multi-stage Dockerfile for Spry Framework Website
+# Build stage: Compile the Vala application
+FROM fedora:43 AS builder
+
+# Install build dependencies
+RUN dnf install -y \
+    meson \
+    ninja-build \
+    gcc \
+    vala \
+    glib2-devel \
+    gobject-introspection-devel \
+    json-glib-devel \
+    libxml2-devel \
+    zlib-devel \
+    libzstd-devel \
+    libgee-devel \
+    brotli-devel \
+    libmicrohttpd-devel \
+    git \
+    pkg-config \
+    && dnf clean all
+
+# Clone and build invercargill library
+WORKDIR /build
+RUN git clone https://fabrica.unitatem.net/Tilo15/Invercargill.git invercargill && \
+    cd invercargill && \
+    meson setup src builddir --prefix=/usr && \
+    ninja -C builddir && \
+    ninja -C builddir install
+
+# Clone and build invercargill-json library
+RUN git clone https://git.sr.ht/~tilo15/Invercargill-Json invercargill-json && \
+    cd invercargill-json && \
+    meson setup src builddir --prefix=/usr && \
+    ninja -C builddir && \
+    ninja -C builddir install
+
+# Clone and build inversion library (depends on invercargill)
+RUN git clone https://fabrica.unitatem.net/Tilo15/inversion.git inversion && \
+    cd inversion && \
+    meson setup builddir --prefix=/usr && \
+    ninja -C builddir && \
+    ninja -C builddir install
+
+# Clone and build astralis library (depends on invercargill, invercargill-json, inversion)
+RUN git clone https://fabrica.unitatem.net/Tilo15/astralis.git astralis && \
+    cd astralis && \
+    meson setup builddir --prefix=/usr && \
+    ninja -C builddir && \
+    ninja -C builddir install && \
+
+# Copy the Spry project source
+COPY . /build/spry
+
+# Build the Spry library and website
+WORKDIR /build/spry
+RUN meson setup builddir --prefix=/usr && \
+    ninja -C builddir && \
+    ninja -C builddir install
+
+# Runtime stage: Minimal image with only necessary runtime libraries
+FROM fedora:43 AS runtime
+
+# Install runtime dependencies only
+RUN dnf install -y \
+    glib2 \
+    json-glib \
+    libxml2 \
+    zlib \
+    libzstd \
+    brotli \
+    libmicrohttpd \
+    libgee \
+    && dnf clean all
+
+# Copy built libraries and executable from builder
+COPY --from=builder /usr/lib64/libinvercargill*.so* /usr/lib64/
+COPY --from=builder /usr/lib64/libinvercargill-json*.so* /usr/lib64/
+COPY --from=builder /usr/lib64/libinversion*.so* /usr/lib64/
+COPY --from=builder /usr/lib64/libastralis*.so* /usr/lib64/
+COPY --from=builder /usr/lib64/libspry*.so* /usr/lib64/
+COPY --from=builder /usr/lib64/girepository-1.0/*.typelib /usr/lib64/girepository-1.0/
+COPY --from=builder /usr/bin/spry-website /usr/bin/
+
+# Update library cache
+RUN ldconfig
+
+# Expose the default port
+EXPOSE 8080
+
+# Set environment variables
+ENV PORT=8080
+
+# Run the website
+CMD ["spry-website", "8080"]

BIN
spry-website.tar.gz


+ 1 - 1
website/meson.build

@@ -24,5 +24,5 @@ m_dep = meson.get_compiler('c').find_library('m', required: false)
 executable('spry-website',
     website_sources,
     dependencies: [spry_dep, astralis_dep, invercargill_dep, inversion_dep, m_dep],
-    install: false
+    install: true
 )