Add horoscope-api, synastry, and backend services
- horoscope-api: Swiss Ephemeris natal charts, timezone/place resolution, POST /v1/natal and POST /v1/synastry - backend: users with roles, email/password and Google login, saved charts, synastries and invites, analyses with credit ledger, public shares, admin - shared crates: astro-engine, db (migrations), horoscope-client, service-kit - docker-compose with postgres, legacy Java project for reference Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
#
|
||||
# Build from the repository root:
|
||||
# docker build -f services/horoscope-api/Dockerfile -t sorsfonalak/horoscope-api .
|
||||
#
|
||||
# All external data (Swiss Ephemeris, IANA tzdb with backzone, GeoNames) is
|
||||
# downloaded at build time; the running container needs no network access.
|
||||
|
||||
ARG RUST_VERSION=1.99
|
||||
|
||||
# --- 1. external data and C sources -------------------------------------------
|
||||
FROM alpine:3.22 AS deps
|
||||
RUN apk add --no-cache curl build-base gawk unzip
|
||||
ARG SWISSEPH_VERSION=v2.10.3bfinal
|
||||
ARG SWISSEPH_EPHE_FILES="sepl_18.se1 semo_18.se1 seas_18.se1"
|
||||
ARG TZDB_VERSION=2026f
|
||||
ARG GEONAMES_CITIES=cities500
|
||||
ARG GEONAMES_FULL_COUNTRIES=HU
|
||||
COPY scripts/fetch-deps.sh /fetch-deps.sh
|
||||
RUN SWISSEPH_VERSION="$SWISSEPH_VERSION" SWISSEPH_EPHE_FILES="$SWISSEPH_EPHE_FILES" \
|
||||
TZDB_VERSION="$TZDB_VERSION" GEONAMES_CITIES="$GEONAMES_CITIES" \
|
||||
GEONAMES_FULL_COUNTRIES="$GEONAMES_FULL_COUNTRIES" \
|
||||
sh /fetch-deps.sh /out
|
||||
|
||||
# --- 2. static (musl) build ----------------------------------------------------
|
||||
FROM rust:${RUST_VERSION}-alpine AS build
|
||||
RUN apk add --no-cache musl-dev
|
||||
WORKDIR /app
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates crates
|
||||
COPY services services
|
||||
COPY --from=deps /out/vendor vendor
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/app/target \
|
||||
cargo build --release --locked -p horoscope-api \
|
||||
&& cp target/release/horoscope-api /horoscope-api
|
||||
|
||||
# --- 3. runtime: binary + data only --------------------------------------------
|
||||
FROM scratch
|
||||
COPY --from=build /horoscope-api /horoscope-api
|
||||
COPY --from=deps /out/data /data
|
||||
COPY --from=deps /out/vendor/swisseph/LICENSE /licenses/swisseph-LICENSE
|
||||
ENV ASTRO_DATA_DIR=/data \
|
||||
BIND_ADDR=0.0.0.0:8080 \
|
||||
LOG_FORMAT=json \
|
||||
RUST_LOG=info
|
||||
USER 65532:65532
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD ["/horoscope-api", "healthcheck"]
|
||||
ENTRYPOINT ["/horoscope-api"]
|
||||
Reference in New Issue
Block a user