···1+ARG GLEAM_VERSION=v1.13.0
2+3+# Build stage - compile the application
4+FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine AS builder
5+6+# Install build dependencies including Rust for NIFs
7+RUN apk add --no-cache \
8+ git \
9+ build-base \
10+ sqlite-dev \
11+ rust \
12+ cargo
13+14+# Configure git for non-interactive use
15+ENV GIT_TERMINAL_PROMPT=0
16+17+# Add local dependencies first (these change less frequently)
18+COPY ./jetstream /build/jetstream
19+COPY ./lexicon /build/lexicon
20+COPY ./graphql /build/graphql
21+COPY ./lexicon_graphql /build/lexicon_graphql
22+23+# Add server code
24+COPY ./server /build/server
25+26+# Build Rust NIFs for lexicon package (Linux build produces .so)
27+RUN cd /build/lexicon/native/lexicon_nif && cargo build --release && \
28+ mkdir -p /build/lexicon/priv && \
29+ cp /build/lexicon/native/lexicon_nif/target/release/liblexicon_nif.so /build/lexicon/priv/liblexicon_nif.so
30+31+# Install dependencies for all projects
32+RUN cd /build/jetstream && gleam deps download
33+RUN cd /build/lexicon && gleam deps download
34+RUN cd /build/graphql && gleam deps download
35+RUN cd /build/lexicon_graphql && gleam deps download
36+RUN cd /build/server && gleam deps download
37+38+# Compile the server code
39+RUN cd /build/server \
40+ && gleam export erlang-shipment
41+42+# Runtime stage - slim image with only what's needed to run
43+FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine
44+45+# Install runtime dependencies
46+RUN apk add --no-cache sqlite-libs
47+48+# Copy the compiled server code from the builder stage
49+COPY --from=builder /build/server/build/erlang-shipment /app
50+51+# Copy lexicons directory to the runtime image
52+COPY --from=builder /build/server/priv/lexicons /app/priv/lexicons
53+54+# Set up the entrypoint
55+WORKDIR /app
56+RUN echo -e '#!/bin/sh\nexec ./entrypoint.sh "$@"' > ./start.sh \
57+ && chmod +x ./start.sh
58+59+# Set environment variables
60+ENV HOST=0.0.0.0
61+ENV PORT=8000
62+63+# Expose the port the server will run on
64+EXPOSE $PORT
65+66+# Run the server
67+CMD ["./start.sh", "run"]
+18
server/.env.example
···000000000000000000
···1+# AIP (AT Protocol Identity Provider) Configuration
2+AIP_BASE_URL=https://auth.example.com
3+4+# Server Configuration
5+# HOST: The interface to bind to (use 0.0.0.0 for Docker, 127.0.0.1 for local dev)
6+HOST=127.0.0.1
7+# PORT: The port to listen on
8+PORT=8000
9+10+# Database Configuration
11+DATABASE_URL=quickslice.db
12+13+# Jetstream Configuration
14+JETSTREAM_URL=wss://jetstream2.us-east.bsky.network/subscribe
15+16+# Relay Configuration
17+RELAY_URL=https://relay1.us-west.bsky.network
18+PLC_DIRECTORY_URL=https://plc.directory