init new frontend
This commit is contained in:
+14
-1
@@ -6,6 +6,16 @@ FROM rust:1.96-alpine3.24 AS base
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache musl-dev pkgconfig gcc perl make
|
||||
|
||||
# ─── Stage 1b: Build the SvelteKit frontend (Vite) ───────────────────────────
|
||||
# Produces the SPA in /static-dist. `npm ci` is cached unless the lockfile
|
||||
# changes; the Rust build no longer bundles assets (see build.rs).
|
||||
FROM node:24-alpine AS frontend
|
||||
WORKDIR /frontend
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# ─── Stage 2: Cache dependencies ─────────────────────────────────────────────
|
||||
FROM base AS cacher
|
||||
WORKDIR /app
|
||||
@@ -39,6 +49,9 @@ COPY templates templates
|
||||
# Build with all optimizations (DATABASE_URL only needed at compile-time for sqlx)
|
||||
ARG DATABASE_URL="postgres://postgres:postgres@localhost/oxicloud"
|
||||
RUN DATABASE_URL="${DATABASE_URL}" cargo build --release
|
||||
# The SPA is built by the frontend stage; bring it in for the runtime copy below.
|
||||
# (build.rs no longer generates static-dist unless OXICLOUD_LEGACY_ASSETS=1.)
|
||||
COPY --from=frontend /static-dist ./static-dist
|
||||
|
||||
# ─── Stage 4: Minimal runtime image ──────────────────────────────────────────
|
||||
FROM alpine:3.24.0
|
||||
@@ -71,7 +84,7 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN sed -i 's/\r//' /usr/local/bin/entrypoint.sh && \
|
||||
chmod 755 /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Copy processed static files (bundled/minified by build.rs in release)
|
||||
# Copy the built SPA (produced by the Vite frontend stage)
|
||||
COPY --from=builder --chown=oxicloud:oxicloud /app/static-dist /app/static
|
||||
# Create storage directory with proper permissions
|
||||
RUN mkdir -p /app/storage && chown -R oxicloud:oxicloud /app/storage
|
||||
|
||||
Reference in New Issue
Block a user