Spaces:
Paused
Paused
ML Intern deploy
Deploy httpSMS gateway to Hugging Face Spaces (Docker SDK): nginx :7860 -> Go API :8000, Nuxt SPA, Android APK, bootstrap-mode entrypoint
83a59ca Download Dockerfile from red-kit/httpsms-gateway: direct link, hf CLI and curl.
- Browser
- Download file 1.7 kB
-
https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/red-kit/httpsms-gateway/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/red-kit/httpsms-gateway/resolve/main/Dockerfile
1.7 kB
| # syntax=docker/dockerfile:1 | |
| # ============================================================ | |
| # Stage 1 — Nuxt 3 static SPA build (web/) | |
| # ============================================================ | |
| FROM node:22-alpine AS web-builder | |
| WORKDIR /build | |
| COPY web/ ./ | |
| RUN npm install -g pnpm@11.11.0 \ | |
| && pnpm install --frozen-lockfile | |
| # web/.env (committed, public build-time config: API_BASE_URL, Firebase web config, Turnstile site key) | |
| RUN pnpm generate | |
| # -> /build/.output/public (static SPA) | |
| # ============================================================ | |
| # Stage 2 — Go Fiber API build (api/) | |
| # ============================================================ | |
| FROM golang:1.26-alpine AS api-builder | |
| WORKDIR /build | |
| COPY api/ ./ | |
| RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -o /httpsms-api . | |
| # ============================================================ | |
| # Stage 3 — runtime: nginx :7860 + API :8000 + psql seeding | |
| # ============================================================ | |
| FROM alpine:3.20 | |
| RUN apk add --no-cache nginx postgresql postgresql-client redis ca-certificates curl tzdata \ | |
| && adduser -D -u 1000 user \ | |
| && mkdir -p /usr/share/nginx/html /var/log/nginx /var/lib/nginx \ | |
| && chown -R user:user /usr/share/nginx/html /var/log/nginx /var/lib/nginx /etc/nginx /tmp | |
| COPY --from=web-builder --chown=user:user /build/.output/public/ /usr/share/nginx/html/ | |
| COPY --from=api-builder --chown=user:user /httpsms-api /usr/local/bin/httpsms-api | |
| COPY --chown=user:user nginx.hf.conf /etc/nginx/nginx.conf | |
| COPY --chown=user:user entrypoint.sh /entrypoint.sh | |
| RUN chmod +x /entrypoint.sh | |
| USER user | |
| ENV HOME=/home/user | |
| WORKDIR /home/user | |
| EXPOSE 7860 | |
| ENTRYPOINT ["/entrypoint.sh"] | |