-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.57 KB
/
Dockerfile
File metadata and controls
53 lines (39 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ── Build frontend ─────────────────────────────────────────────────────────
FROM node:20-alpine AS build-frontend
ARG VITE_FB_APP_ID
ENV VITE_FB_APP_ID=$VITE_FB_APP_ID
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# ── Build sync server ──────────────────────────────────────────────────────
FROM node:20-alpine AS build-server
WORKDIR /server
COPY server/package*.json ./
RUN npm ci
COPY server/ .
RUN npx tsc
# ── Runtime stage ──────────────────────────────────────────────────────────
FROM node:20-alpine AS runtime
# Install nginx
RUN apk add --no-cache nginx
# nginx config
RUN rm -f /etc/nginx/http.d/default.conf
COPY nginx.conf /etc/nginx/http.d/default.conf
# Static assets
COPY --from=build-frontend /app/dist /usr/share/nginx/html
# Sync server
WORKDIR /server
COPY --from=build-server /server/dist ./dist
COPY --from=build-server /server/node_modules ./node_modules
COPY --from=build-server /server/package.json ./
# Data directory for SQLite (mount as volume for persistence)
RUN mkdir -p /data/sync
# Entrypoint script to start both nginx and the sync server
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 80
ENV SYNC_PORT=3001
ENV SYNC_DATA_DIR=/data/sync
CMD ["/entrypoint.sh"]