feat: redesign admin panel & profile page, optimize Dockerfile, remove rootless
- Completely redesign admin.html matching OxiCloud design system - Create standalone profile.html page with avatar, details & password change - Optimize Dockerfile: 3-stage build, non-root user, OCI labels, layer cache - Add .dockerignore to reduce build context - Remove redundant Dockerfile.rootless & rootless-compose.yml - Redesign login language selector as compact dropdown with search - Fix CI/CD workflows (ci.yml, docker-build.yml, docker-publish.yml) - Update app.js to navigate to profile page instead of modal
This commit is contained in:
+30
-15
@@ -14,39 +14,54 @@ FROM rust:1.93.0-alpine3.23 AS builder
|
||||
WORKDIR /app
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache musl-dev pkgconfig postgresql-dev gcc perl make
|
||||
# Copy cached dependencies
|
||||
# Copy cached dependencies (only target dir and cargo registry)
|
||||
COPY --from=cacher /app/target target
|
||||
COPY --from=cacher /usr/local/cargo /usr/local/cargo
|
||||
# Copy ALL files needed for compilation, including static files
|
||||
COPY src src
|
||||
COPY static static
|
||||
COPY db db
|
||||
COPY --from=cacher /usr/local/cargo/registry /usr/local/cargo/registry
|
||||
# Copy only what Cargo needs to compile (static/db are runtime-only, copied in final stage)
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
# Build with all optimizations
|
||||
ENV DATABASE_URL="postgres://postgres:postgres@postgres/oxicloud"
|
||||
RUN cargo build --release
|
||||
COPY src src
|
||||
# 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
|
||||
|
||||
# Stage 3: Create minimal final image
|
||||
FROM alpine:3.23.3
|
||||
|
||||
# OCI image metadata
|
||||
LABEL org.opencontainers.image.title="OxiCloud" \
|
||||
org.opencontainers.image.description="Ultra-fast, secure & lightweight self-hosted cloud storage built in Rust" \
|
||||
org.opencontainers.image.url="https://github.com/DioCrafts/OxiCloud" \
|
||||
org.opencontainers.image.source="https://github.com/DioCrafts/OxiCloud" \
|
||||
org.opencontainers.image.vendor="DioCrafts" \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
|
||||
# Install only necessary runtime dependencies and update packages
|
||||
RUN apk --no-cache upgrade && \
|
||||
apk add --no-cache libgcc ca-certificates libpq tzdata
|
||||
|
||||
# Create non-root user
|
||||
RUN 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 static files and other resources needed at runtime
|
||||
COPY static /app/static
|
||||
COPY db /app/db
|
||||
COPY --chown=oxicloud:oxicloud static /app/static
|
||||
COPY --chown=oxicloud:oxicloud db /app/db
|
||||
|
||||
# Create storage directory with proper permissions
|
||||
RUN mkdir -p /app/storage && chmod 777 /app/storage
|
||||
|
||||
# Set proper permissions
|
||||
RUN chmod +x /usr/local/bin/oxicloud
|
||||
RUN mkdir -p /app/storage && chown oxicloud:oxicloud /app/storage
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Expose application port
|
||||
EXPOSE 8086
|
||||
|
||||
# Run as non-root user
|
||||
USER oxicloud
|
||||
|
||||
# Run the application
|
||||
CMD ["oxicloud"]
|
||||
|
||||
Reference in New Issue
Block a user