-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (38 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
55 lines (38 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Stage 1: Build frontend
FROM node:24-alpine AS frontend
RUN npm install -g bun@latest
WORKDIR /build/frontend-panel
COPY frontend-panel/package.json frontend-panel/bun.lock* ./
RUN bun install --frozen-lockfile
COPY frontend-panel/ ./
RUN bun run build
# Stage 2: Build Rust binary
FROM rust:1-alpine AS builder
RUN apk add --no-cache build-base pkgconfig sqlite-dev curl
WORKDIR /build
COPY Cargo.toml Cargo.lock ./
COPY migration/ migration/
COPY api-docs-macros/ api-docs-macros/
# Pre-build dependencies (cache layer)
RUN mkdir src && echo 'fn main() {}' > src/main.rs && \
cargo build --release 2>/dev/null || true && \
rm -rf src
COPY src/ src/
COPY build.rs ./
COPY --from=frontend /build/frontend-panel/dist/ frontend-panel/dist/
ARG CARGO_FEATURES="server"
ENV RUSTFLAGS="-C link-arg=-s"
RUN cargo build --release --features "${CARGO_FEATURES}"
# Stage 3: Alpine runtime
FROM alpine:3.22
RUN apk add --no-cache ca-certificates sqlite-libs
LABEL maintainer="AptS:1547 <apts-1547@esaps.net>"
LABEL org.opencontainers.image.title="AsterDrive"
LABEL org.opencontainers.image.description="Self-hosted cloud storage system built with Rust"
LABEL org.opencontainers.image.source="https://github.com/AptS-1547/AsterDrive"
LABEL org.opencontainers.image.license="MIT"
COPY --from=builder /build/target/release/aster_drive /aster_drive
VOLUME ["/data"]
EXPOSE 3000
ENV ASTER__SERVER__HOST=0.0.0.0
ENTRYPOINT ["/aster_drive"]