Update Dockerfile
Browse files- Dockerfile +1 -74
Dockerfile
CHANGED
|
@@ -1,74 +1 @@
|
|
| 1 |
-
|
| 2 |
-
# World Monitor β Docker Image
|
| 3 |
-
# =============================================================================
|
| 4 |
-
# Multi-stage build:
|
| 5 |
-
# builder β installs deps, compiles TS handlers, builds Vite frontend
|
| 6 |
-
# final β nginx (static) + node (API) under supervisord
|
| 7 |
-
# =============================================================================
|
| 8 |
-
|
| 9 |
-
# ββ Stage 1: Builder βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 10 |
-
FROM node:22-alpine AS builder
|
| 11 |
-
|
| 12 |
-
WORKDIR /app
|
| 13 |
-
|
| 14 |
-
RUN git clone https://github.com/koala73/worldmonitor.git
|
| 15 |
-
|
| 16 |
-
# Install root dependencies (layer-cached until package.json changes)
|
| 17 |
-
COPY package.json package-lock.json ./
|
| 18 |
-
RUN npm ci --ignore-scripts
|
| 19 |
-
|
| 20 |
-
# Copy full source
|
| 21 |
-
COPY . .
|
| 22 |
-
|
| 23 |
-
# Compile TypeScript API handlers β self-contained ESM bundles
|
| 24 |
-
# Output is api/**/*.js alongside the source .ts files
|
| 25 |
-
RUN node docker/build-handlers.mjs
|
| 26 |
-
|
| 27 |
-
# Build Vite frontend (outputs to dist/)
|
| 28 |
-
# Skip blog build β blog-site has its own deps not installed here
|
| 29 |
-
RUN npx tsc && npx vite build
|
| 30 |
-
|
| 31 |
-
# ββ Stage 2: Runtime βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 32 |
-
FROM node:22-alpine AS final
|
| 33 |
-
|
| 34 |
-
# nginx + supervisord
|
| 35 |
-
RUN apk add --no-cache nginx supervisor gettext && \
|
| 36 |
-
mkdir -p /tmp/nginx-client-body /tmp/nginx-proxy /tmp/nginx-fastcgi \
|
| 37 |
-
/tmp/nginx-uwsgi /tmp/nginx-scgi /var/log/supervisor && \
|
| 38 |
-
addgroup -S appgroup && adduser -S appuser -G appgroup
|
| 39 |
-
|
| 40 |
-
WORKDIR /app
|
| 41 |
-
|
| 42 |
-
# API server
|
| 43 |
-
COPY --from=builder /app/src-tauri/sidecar/local-api-server.mjs ./local-api-server.mjs
|
| 44 |
-
COPY --from=builder /app/src-tauri/sidecar/package.json ./package.json
|
| 45 |
-
|
| 46 |
-
# API handler modules (JS originals + compiled TS bundles)
|
| 47 |
-
COPY --from=builder /app/api ./api
|
| 48 |
-
|
| 49 |
-
# Static data files used by handlers at runtime
|
| 50 |
-
COPY --from=builder /app/data ./data
|
| 51 |
-
|
| 52 |
-
# Built frontend static files
|
| 53 |
-
COPY --from=builder /app/dist /usr/share/nginx/html
|
| 54 |
-
|
| 55 |
-
# Nginx + supervisord configs
|
| 56 |
-
COPY docker/nginx.conf /etc/nginx/nginx.conf.template
|
| 57 |
-
COPY docker/supervisord.conf /etc/supervisor/conf.d/worldmonitor.conf
|
| 58 |
-
COPY docker/entrypoint.sh /app/entrypoint.sh
|
| 59 |
-
RUN chmod +x /app/entrypoint.sh
|
| 60 |
-
|
| 61 |
-
# Ensure writable dirs for non-root
|
| 62 |
-
RUN chown -R appuser:appgroup /app /tmp/nginx-client-body /tmp/nginx-proxy \
|
| 63 |
-
/tmp/nginx-fastcgi /tmp/nginx-uwsgi /tmp/nginx-scgi /var/log/supervisor \
|
| 64 |
-
/var/lib/nginx /var/log/nginx
|
| 65 |
-
|
| 66 |
-
USER appuser
|
| 67 |
-
|
| 68 |
-
EXPOSE 8080
|
| 69 |
-
|
| 70 |
-
# Healthcheck via nginx
|
| 71 |
-
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
| 72 |
-
CMD wget -qO- http://localhost:8080/api/health || exit 1
|
| 73 |
-
|
| 74 |
-
CMD ["/app/entrypoint.sh"]
|
|
|
|
| 1 |
+
FROM ghcr.io/koala73/worldmonitor:latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|