- Multi-stage Dockerfile: builder compiles native modules (better-sqlite3, tiny-secp256k1) under target architecture, runtime is minimal Alpine - install.sh: POSIX sh installer (Alpine ash compatible) with architecture detection, Docker install, .env validation, health-check retry loop - docker-compose.yml: removed platform locks, .env read-only mount, 127.0.0.1 port binding, 384m mem limit (Orange Pi Zero 2 safe) - .dockerignore: excludes node_modules, secrets, tests, .kilo - README.md: complete rewrite with deployment docs for any device - Verified: POSIX sh syntax (dash), Dockerfile (docker build --check), docker-compose (docker compose config)
47 lines
875 B
Docker
47 lines
875 B
Docker
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN apk add --no-cache --virtual .build-deps \
|
|
python3 \
|
|
make \
|
|
g++ \
|
|
gcc \
|
|
linux-headers \
|
|
git \
|
|
py3-setuptools \
|
|
&& npm install --omit=dev \
|
|
&& apk del .build-deps
|
|
|
|
# ============================================================
|
|
# Runtime image
|
|
# ============================================================
|
|
FROM node:22-alpine
|
|
|
|
RUN apk add --no-cache \
|
|
bash \
|
|
bind-tools \
|
|
curl \
|
|
iptables \
|
|
iproute2 \
|
|
openresolv \
|
|
wireguard-tools
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY package*.json ./
|
|
|
|
COPY ./src ./src
|
|
|
|
COPY ./wg/start.sh /app/start.sh
|
|
RUN chmod +x /app/start.sh
|
|
|
|
RUN mkdir -p /app/db /app/uploads
|
|
|
|
EXPOSE 3001
|
|
|
|
CMD ["/bin/bash", "/app/start.sh"]
|