add Containerfile + compose.yml
Co-Authored-By: Qwen3.8 27b
A.containerignore
@@ -0,0 +1,12 @@
.git
.dev
Containerfile
compose.yml
target
server/dist
web/dist
web/cm6.js
web/node_modules
*.sqlite
*.sqlite-wal
*.sqlite-shm
AContainerfile
@@ -0,0 +1,52 @@
ARG RUST_VERSION=1.90
ARG BUN_VERSION=1.4.0
ARG TRUNK_VERSION=0.21.14
ARG ALPINE_VERSION=3.22
# ── build ────────────────────────────────────────────────────────────────────
FROM rust:${RUST_VERSION}-alpine${ALPINE_VERSION} AS build
# re-declare the build-args: args set before FROM do not carry into stages
ARG BUN_VERSION
ARG TRUNK_VERSION
# binaryen so trunk uses the system wasm-opt instead of downloading a glibc binary that cannot run on musl
RUN apk add --no-cache curl ca-certificates musl-dev binaryen just \
&& rustup target add wasm32-unknown-unknown
# bun
COPY --from=oven/bun:${BUN_VERSION}-alpine /usr/local/bin/bun /usr/local/bin/bun
# trunk
RUN set -eux; \
url=https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-musl.tar.gz; \
curl -fsSL -o /tmp/trunk.tar.gz "${url}"; \
curl -fsSL "${url}.sha256" | awk '{print $1 " /tmp/trunk.tar.gz"}' | sha256sum -c -; \
tar xzf /tmp/trunk.tar.gz -C /usr/local/bin; \
rm -f /tmp/trunk.tar.gz
WORKDIR /src
COPY . /src
# build
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/src/target \
just build \
&& cp target/release/filebrowser-ng /src/filebrowser-ng
# ── runtime ──────────────────────────────────────────────────────────────────
FROM alpine:${ALPINE_VERSION}
RUN apk add --no-cache ca-certificates \
&& mkdir -p /data /var/lib/filebrowser
COPY --from=build /src/filebrowser-ng /usr/local/bin/filebrowser-ng
EXPOSE 8080
VOLUME ["/data", "/var/lib/filebrowser"]
HEALTHCHECK --interval=30s --start-period=10s --timeout=5s --retries=3 \
CMD wget -qO /dev/null http://127.0.0.1:8080/ || exit 1
ENTRYPOINT ["/usr/local/bin/filebrowser-ng"]
CMD ["--root", "/data", "--db", "/var/lib/filebrowser/db.sqlite", "--bind", "0.0.0.0"]
Acompose.yml
@@ -0,0 +1,11 @@
services:
filebrowser:
build: .
image: filebrowser-ng:latest
ports:
- "8080:8080"
environment:
RUST_LOG: info # server log level: trace/debug/info/warn/error
volumes:
- ./data:/data # browsed files (server --root)
- ./filebrowser-db:/var/lib/filebrowser # sqlite db: users, shares, settings
Mjustfile
@@ -31,7 +31,7 @@ frontend: build-cm
# Production single binary (frontend embedded).
build: frontend
cargo build --release -p server --features embedded
cargo build --locked --release -p server --features embedded
# Production end-to-end: build the real frontend, embed it, and run the full server test suite.
e2e: frontend