feat: add local sharing and containerized web/server layout

This commit is contained in:
lofyer
2026-10-01 12:01:44 +08:00
parent 599a0a6645
commit c9d5e63276
51 changed files with 2212 additions and 233 deletions
+27
View File
@@ -0,0 +1,27 @@
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runtime
ENV NODE_ENV=production
ENV SHARESERVER_PORT=8787
ENV SHARESERVER_HOST=0.0.0.0
ENV SHARESERVER_DATA_DIR=/app/data
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev && mkdir -p /app/data && chown node:node /app/data
COPY --from=build /app/dist/web ./dist/web
COPY --from=build /app/dist/server ./dist/server
USER node
EXPOSE 8787
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:' + process.env.SHARESERVER_PORT + '/api/v1/public/health', { signal: AbortSignal.timeout(4000) }).then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"
CMD ["node", "dist/server/server/src/index.js"]
+9
View File
@@ -0,0 +1,9 @@
build-server
dist
node_modules
*.log
*.png
.git
data
.env
.env.*
+16
View File
@@ -0,0 +1,16 @@
name: goodbuddy-shareserver
services:
shareserver:
build:
context: ..
dockerfile: docker/Dockerfile
ports:
- "8787:8787"
volumes:
- type: bind
source: ../data
target: /app/data
bind:
create_host_path: false
restart: unless-stopped