Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.codex
dist
web/dist
web/node_modules
**/.DS_Store
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ dist/
build/
*.log
.env*
!.env.example
*.exe
*.test
vendor/
*.out
design/
/mindfs
/mindfs
57 changes: 57 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 17 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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}