hss-pos / Dockerfile
sashank1989
fix: persist DB via HF Dataset repo — bucket FUSE mount doesn't support SQLite writes
e87926e
Raw
History Blame Contribute Delete
1.84 kB
# ============================================================================
# Stage 1: Build Svelte frontend
# ============================================================================
FROM node:22-alpine AS frontend-builder
WORKDIR /build/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ .
RUN npm run build
# ============================================================================
# Stage 2: Build Go backend
# ============================================================================
FROM golang:1.23-alpine AS backend-builder
WORKDIR /build/backend
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o server ./cmd/server
# ============================================================================
# Stage 3: Production runtime
# ============================================================================
FROM alpine:3.19
RUN apk --no-cache add ca-certificates tzdata python3 py3-pip \
&& pip3 install --no-cache-dir --break-system-packages huggingface-hub
WORKDIR /app
RUN mkdir -p /app/data /app/static
# Copy Go binary
COPY --from=backend-builder /build/backend/server .
# Copy entrypoint script
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
# Copy built frontend
COPY --from=frontend-builder /build/frontend/build ./static
# Environment
# DB runs on local disk for proper SQLite locking/WAL support.
# HF_TOKEN is set as a Space secret — used by entrypoint.sh for DB backup/restore.
ENV PORT=7860
ENV ENVIRONMENT=production
ENV DB_PATH=/app/data/restaurant.db
ENV STATIC_DIR=/app/static
ENV UPLOAD_DIR=/app/data/uploads
ENV CORS_ORIGINS=*
ENV JWT_SECRET=hss-pos-hf-deploy-2026
ENV HF_BACKUP_REPO=FordAI/hss-pos-backup
EXPOSE 7860
CMD ["./entrypoint.sh"]