From b6b1b56897eb2023992b6c9b09bc3dd6e3d5a4df Mon Sep 17 00:00:00 2001 From: nzlov Date: Wed, 29 Apr 2026 18:01:54 +0800 Subject: [PATCH 1/2] feat: docker --- .dockerignore | 6 +++++ .env.example | 9 +++++++ .gitignore | 3 ++- Dockerfile | 57 +++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yaml | 21 +++++++++++++++++ 5 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 .env.example create mode 100644 Dockerfile create mode 100644 docker-compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..77c33af --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.git +.codex +dist +web/dist +web/node_modules +**/.DS_Store diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..d0bcf7c --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# Host port mapping +MINDFS_PORT=7331 + +# MindFS runtime options inside the container +MINDFS_ADDR=0.0.0.0:7331 +MINDFS_ROOT=/workspace + +# Docker Compose restart policy +MINDFS_RESTART=unless-stopped diff --git a/.gitignore b/.gitignore index 4b38567..2acdcea 100644 --- a/.gitignore +++ b/.gitignore @@ -14,9 +14,10 @@ dist/ build/ *.log .env* +!.env.example *.exe *.test vendor/ *.out design/ -/mindfs \ No newline at end of file +/mindfs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6483a8b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +FROM archlinux:latest AS base + +RUN pacman -Syu --noconfirm \ + ca-certificates \ + git \ + go \ + nodejs \ + npm \ + && pacman -Scc --noconfirm + +FROM base AS web-builder + +WORKDIR /src/web + +COPY web/package.json web/package-lock.json ./ +RUN npm ci \ + && npm cache clean --force \ + && rm -rf /root/.npm + +COPY web/ ./ +RUN npm run build \ + && npm cache clean --force \ + && rm -rf /root/.npm + +FROM base AS go-builder + +ARG VERSION=dev +ARG TARGETOS=linux +ARG TARGETARCH + +WORKDIR /src + +COPY go.mod go.sum ./ +RUN go mod download + +COPY cli/ ./cli/ +COPY server/ ./server/ + +RUN CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH:-amd64}" \ + go build -trimpath -ldflags "-s -w" \ + -o /out/mindfs ./cli/cmd \ + && go clean -modcache -cache + +FROM base AS runtime + +RUN mkdir -p /opt/mindfs/bin /opt/mindfs/share/mindfs /workspace + +COPY --from=go-builder /out/mindfs /opt/mindfs/bin/mindfs +COPY --from=web-builder /src/web/dist /opt/mindfs/share/mindfs/web +COPY agents.json /opt/mindfs/share/mindfs/agents.json + +WORKDIR /workspace + +EXPOSE 7331 + +ENTRYPOINT ["/opt/mindfs/bin/mindfs"] +CMD ["--foreground", "-addr", "0.0.0.0:7331", "/workspace"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..14126a6 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +services: + mindfs: + build: + context: . + dockerfile: Dockerfile + ports: + - "${MINDFS_PORT:-7331}:7331" + volumes: + - ./workspace:/workspace + - ./data/config:/root/.config + - ./data/local:/root/.local + command: + - --foreground + - -addr + - ${MINDFS_ADDR:-0.0.0.0:7331} + - ${MINDFS_ROOT:-/workspace} + restart: ${MINDFS_RESTART:-unless-stopped} + +volumes: + mindfs-config: + mindfs-state: From 6ddc6c6ed63a29c1226f5b519c82837b4565f7a0 Mon Sep 17 00:00:00 2001 From: nzlov Date: Fri, 8 May 2026 14:36:59 +0800 Subject: [PATCH 2/2] Update docker-compose.yaml --- docker-compose.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 14126a6..e025d03 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,7 +15,3 @@ services: - ${MINDFS_ADDR:-0.0.0.0:7331} - ${MINDFS_ROOT:-/workspace} restart: ${MINDFS_RESTART:-unless-stopped} - -volumes: - mindfs-config: - mindfs-state: