diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4eaabbc..95646e1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,6 +32,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Build frontend + working-directory: web + run: npm ci && npm run build + - name: Cache Rust build uses: actions/cache@v4 with: diff --git a/Dockerfile b/Dockerfile index 1ee8aa1..9dbd6dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,11 @@ +FROM node:22-alpine AS frontend + +WORKDIR /app/web +COPY web/package.json web/package-lock.json ./ +RUN npm ci +COPY web/ . +RUN npm run build + FROM rust:1.93 AS builder WORKDIR /app @@ -18,6 +26,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN useradd -r -s /bin/false happyview COPY --from=builder /app/target/release/happyview /usr/local/bin/happyview +COPY --from=frontend /app/web/out /srv/static + +ENV STATIC_DIR=/srv/static USER happyview diff --git a/docker-compose.yml b/docker-compose.yml index 3bc063d..b4777dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,6 +56,18 @@ services: aip: condition: service_started + web: + image: node:22-alpine + working_dir: /app + command: npm run dev + ports: + - "3001:3001" + volumes: + - ./web:/app + - /app/node_modules + environment: + - HOSTNAME=0.0.0.0 + volumes: pgdata: aip-pgdata: