Skip to content

Commit c47ade5

Browse files
FelixClementsFelixClements
authored andcommitted
Redirect opencode data directory to /data volume
Symlink /home/node/.local/share/opencode to /data/opencode so that auth.json and other opencode data are stored in the mounted /data volume instead of the container's internal storage. Update ownership to include the new symlink target.
1 parent a3bd11a commit c47ade5

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y \
66
curl \
77
bash \
88
gosu \
9+
git \
910
&& rm -rf /var/lib/apt/lists/*
1011

1112
# 3. Install opencode-ai globally

docker-entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ create_directories() {
3838
ln -sf "$CONFIG_DIR" /root/.config/opencode
3939
fi
4040

41+
# Symlink for opencode data directory (auth.json, logs, etc.)
42+
mkdir -p /home/node/.local/share
43+
if [ ! -L /home/node/.local/share/opencode ]; then
44+
ln -sf "$DATA_DIR/opencode" /home/node/.local/share/opencode
45+
fi
46+
4147
echo "Directory structure created successfully."
4248
}
4349

@@ -47,6 +53,7 @@ set_ownership() {
4753
echo "Setting ownership to PUID=$PUID, PGID=$PGID..."
4854
chown -R "$PUID:$PGID" "$DATA_DIR"
4955
chown -R "$PUID:$PGID" /root/.config
56+
chown -R "$PUID:$PGID" /home/node/.local
5057
fi
5158
}
5259

0 commit comments

Comments
 (0)