by Aeolun · 5y ago · 0 comments
[EDIT] Someone did it already: https://github.com/PaperStork/focalboard/pull/1/commits/6452...
Anyways, here's a Dockerfile I whipped up that builds and runs a local version configured to use sqlite. No nginx or other stuff, it's just simple localhost config (not production ready):
# Focalboard v0.6.1 requires node 10+
FROM node:15-buster-slim
# Focalboard source to clone.
ARG FOCALBOARD_REPO="https://github.com/mattermost/focalboard.git"
ARG FOCALBOARD_BRANCH="v0.6.1"
# Focalboard v0.6.1 requires make.
RUN apt-get update && apt-get install -y \
gcc \
git \
make \
&& rm -rf /var/lib/apt/lists/*
# Focalboard v0.6.1 requires go 1.15+
COPY --from=golang:1.16-buster /usr/local/go /usr/local/go
ENV PATH="/usr/local/go/bin:$PATH"
# Clone focalboard.
WORKDIR /opt/focalboard
RUN git clone --depth 1 --branch $FOCALBOARD_BRANCH $FOCALBOARD_REPO .
# Build focalboard.
RUN make prebuild \
&& make webapp \
&& make
# Setup a localhost configuration with sqlite.
RUN echo '{\
"serverRoot": "http://localhost:8000",\n\
"port": 8000,\n\
"dbtype": "sqlite3",\n\
"dbconfig": "/data/focalboard.db",\n\
"useSSL": false,\n\
"webpath": "./webapp/pack",\n\
"filespath": "/files",\n\
"telemetry": true,\n\
"session_expire_time": 2592000,\n\
"session_refresh_time": 18000,\n\
"localOnly": false,\n\
"enableLocalMode": true,\n\
"localModeSocketLocation": "/var/tmp/focalboard_local.socket"\n\
}' > /opt/focalboard/config.json
# Uploaded files are stored here.
VOLUME /files
# Sqlite database is stored here.
VOLUME /data
CMD ["/opt/focalboard/bin/focalboard-server"]
It will need a volume at /files for uploaded file storage, and /data for its sqlite database. It exposes a server on port 8000, and an admin API unix socket on /var/tmp/focalboard_local.socket (read their docs for what it's useful for, like resetting passwords). The Dockerfile should be multiarch, but I can only test on amd64. Low spec hardware (raspberry pi) might struggle a bit with the build as it's a non-trivial go server build, and then production webpack bundle... weird failures might be OOM issues.Here's an example of a basic build and run, saving the files and db to a local directory:
<copy Dockerfile contents above to file>
docker build -t focalboard .
docker run --rm -p 8000:8000 -v $PWD/files:/files -v $PWD/data:/data focalboard
Access http://localhost:8000 and it will let you create a new user account.(go wild with the Dockerfile above, I release it in public domain)