feat: add VitePress docs site, music file picker modal, Dockerfile optimization, i18n keys for 14 locales
- Add docs/ with VitePress site (19 pages): guide, config, architecture, FAQ - Add GitHub Actions workflow for auto-deploy to GitHub Pages - Replace music 'Add Tracks' upload picker with in-app audio file browser modal - Add music picker CSS styles with dark theme support - Add missing i18n keys (search_audio, no_audio_files, etc.) to all 14 locales - Optimize Dockerfile: shared base stage, COPY --chmod, consolidated RUN, HEALTHCHECK - Improve README: docs links, updated stats (222+ tests, 14 languages), feature status
This commit is contained in:
+20
-19
@@ -1,8 +1,11 @@
|
||||
# Stage 1: Cache dependencies
|
||||
FROM rust:1.94.0-alpine3.23 AS cacher
|
||||
WORKDIR /app
|
||||
# ─── Stage 1: Shared build base (avoids duplicate apk install) ────────────────
|
||||
FROM rust:1.94.1-alpine3.23 AS base
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache musl-dev pkgconfig postgresql-dev gcc perl make
|
||||
|
||||
# ─── Stage 2: Cache dependencies ─────────────────────────────────────────────
|
||||
FROM base AS cacher
|
||||
WORKDIR /app
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
# build.rs + static/ are needed so the build script can run and set OUT_DIR
|
||||
COPY build.rs ./
|
||||
@@ -13,11 +16,10 @@ RUN mkdir -p src/bin && \
|
||||
echo 'fn main() {}' > src/bin/generate-openapi.rs && \
|
||||
cargo build --release && \
|
||||
rm -rf src static-dist target/release/deps/oxicloud* target/release/build/oxicloud-*
|
||||
# Stage 2: Build the application
|
||||
FROM rust:1.94.0-alpine3.23 AS builder
|
||||
|
||||
# ─── Stage 3: Build the application ──────────────────────────────────────────
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache musl-dev pkgconfig postgresql-dev gcc perl make
|
||||
# Copy cached dependencies (only target dir and cargo registry)
|
||||
COPY --from=cacher /app/target target
|
||||
COPY --from=cacher /usr/local/cargo/registry /usr/local/cargo/registry
|
||||
@@ -30,7 +32,7 @@ COPY migrations migrations
|
||||
ARG DATABASE_URL="postgres://postgres:postgres@localhost/oxicloud"
|
||||
RUN DATABASE_URL="${DATABASE_URL}" cargo build --release
|
||||
|
||||
# Stage 3: Create minimal final image
|
||||
# ─── Stage 4: Minimal runtime image ──────────────────────────────────────────
|
||||
FROM alpine:3.23.3
|
||||
|
||||
# OCI image metadata
|
||||
@@ -44,19 +46,13 @@ LABEL org.opencontainers.image.title="OxiCloud" \
|
||||
# Install only necessary runtime dependencies and update packages
|
||||
# su-exec is needed by the entrypoint to drop privileges after fixing volume permissions
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache libgcc ca-certificates libpq tzdata su-exec
|
||||
|
||||
# Create non-root user
|
||||
RUN addgroup -g 1001 -S oxicloud && \
|
||||
apk add --no-cache libgcc ca-certificates libpq tzdata su-exec && \
|
||||
addgroup -g 1001 -S oxicloud && \
|
||||
adduser -u 1001 -S oxicloud -G oxicloud
|
||||
|
||||
# Copy only the compiled binary
|
||||
COPY --from=builder /app/target/release/oxicloud /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/oxicloud
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
# Copy the compiled binary and entrypoint (--chmod avoids extra RUN chmod layers)
|
||||
COPY --from=builder --chmod=755 /app/target/release/oxicloud /usr/local/bin/
|
||||
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Copy processed static files (bundled/minified by build.rs in release)
|
||||
COPY --from=builder --chown=oxicloud:oxicloud /app/static-dist /app/static
|
||||
@@ -69,6 +65,11 @@ WORKDIR /app
|
||||
# Expose application port
|
||||
EXPOSE 8086
|
||||
|
||||
# Basic health check — verifies the HTTP server responds on the main port.
|
||||
# Docker / Compose / Swarm will mark the container unhealthy after 3 failures.
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD wget -qO- http://localhost:8086/api/version || exit 1
|
||||
|
||||
# Entrypoint fixes volume permissions then drops to oxicloud user.
|
||||
# The container starts as root so it can chown mounted volumes,
|
||||
# then su-exec drops privileges before running the application.
|
||||
|
||||
Reference in New Issue
Block a user