mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
* Initial plan * Add non-root user support to Dockerfile Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com> * Add SECURITY.md documentation Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com> * Add Kubernetes example manifest, verification script, and README updates Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com> * Remove documentation changes (SECURITY.md, k8s-example.yaml, verify script, README updates) Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: theepicsaxguy <39008574+theepicsaxguy@users.noreply.github.com>
96 lines
2.2 KiB
Docker
96 lines
2.2 KiB
Docker
FROM node:20 AS base
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
curl \
|
|
lsof \
|
|
ripgrep \
|
|
ca-certificates \
|
|
grep \
|
|
gawk \
|
|
sed \
|
|
findutils \
|
|
coreutils \
|
|
procps \
|
|
jq \
|
|
less \
|
|
tree \
|
|
file \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
|
|
USER node
|
|
|
|
RUN mkdir -p /home/node/.local/bin && \
|
|
curl -fsSL https://bun.sh/install | bash && \
|
|
ln -s /home/node/.bun/bin/bun /home/node/.local/bin/bun
|
|
|
|
USER root
|
|
|
|
ENV PATH="/home/node/.local/bin:/home/node/.bun/bin:${PATH}"
|
|
|
|
WORKDIR /app
|
|
|
|
FROM base AS deps
|
|
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
|
COPY shared/package.json ./shared/
|
|
COPY backend/package.json ./backend/
|
|
COPY frontend/package.json ./frontend/
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
FROM base AS builder
|
|
|
|
COPY --from=deps /app ./
|
|
COPY shared ./shared
|
|
COPY backend ./backend
|
|
COPY frontend/src ./frontend/src
|
|
COPY frontend/public ./frontend/public
|
|
COPY frontend/index.html frontend/vite.config.ts frontend/tsconfig*.json frontend/components.json frontend/eslint.config.js ./frontend/
|
|
|
|
RUN pnpm --filter frontend build
|
|
|
|
FROM base AS runner
|
|
|
|
USER node
|
|
|
|
RUN mkdir -p /home/node/.local/bin && \
|
|
curl -fsSL https://opencode.ai/install | bash && \
|
|
ln -s /home/node/.opencode/bin/opencode /home/node/.local/bin/opencode
|
|
|
|
USER root
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOST=0.0.0.0
|
|
ENV PORT=5003
|
|
ENV OPENCODE_SERVER_PORT=5551
|
|
ENV DATABASE_PATH=/app/data/opencode.db
|
|
ENV WORKSPACE_PATH=/workspace
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY --from=builder /app/shared ./shared
|
|
COPY --from=builder /app/backend ./backend
|
|
COPY --from=builder /app/frontend/dist ./frontend/dist
|
|
COPY package.json pnpm-workspace.yaml ./
|
|
|
|
RUN mkdir -p /app/backend/node_modules/@opencode-webui && \
|
|
ln -s /app/shared /app/backend/node_modules/@opencode-webui/shared
|
|
|
|
COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
RUN mkdir -p /workspace /app/data && \
|
|
chown -R node:node /workspace /app/data /app
|
|
|
|
USER node
|
|
|
|
EXPOSE 5003
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
|
|
CMD curl -f http://localhost:5003/api/health || exit 1
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["bun", "backend/src/index.ts"]
|