···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
7+RUN apk add --no-cache \
8+ git \
9+ nodejs \
10+ npm \
11+ build-base \
12+ sqlite-dev
13+14+# Configure git for non-interactive use
15+ENV GIT_TERMINAL_PROMPT=0
16+17+# Add project code
18+COPY ./shared /build/shared
19+COPY ./client /build/client
20+COPY ./server /build/server
21+22+# Install dependencies for all projects
23+RUN cd /build/shared && gleam deps download
24+RUN cd /build/client && gleam deps download
25+RUN cd /build/server && gleam deps download
26+27+# Install JavaScript dependencies for client
28+RUN cd /build/client && npm install
29+30+# Compile the client code and output to server's static directory
31+RUN cd /build/client \
32+ && gleam add --dev lustre_dev_tools \
33+ && gleam run -m lustre/dev build client --minify --outdir=/build/server/priv/static
34+35+# Compile the server code
36+RUN cd /build/server \
37+ && gleam export erlang-shipment
38+39+# Runtime stage - slim image with only what's needed to run
40+FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine
41+42+# Copy the compiled server code from the builder stage
43+COPY --from=builder /build/server/build/erlang-shipment /app
44+45+# Set up the entrypoint
46+WORKDIR /app
47+RUN echo -e '#!/bin/sh\nexec ./entrypoint.sh "$@"' > ./start.sh \
48+ && chmod +x ./start.sh
49+50+# Set environment variables
51+ENV HOST=0.0.0.0
52+ENV PORT=8080
53+54+# Expose the port the server will run on
55+EXPOSE $PORT
56+57+# Run the server
58+CMD ["./start.sh", "run"]
+22
fly.toml
···0000000000000000000000
···1+# fly.toml app configuration file generated for atconf on 2025-10-24T14:04:15-07:00
2+#
3+# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+#
5+6+app = 'atconf'
7+primary_region = 'sjc'
8+9+[build]
10+11+[http_service]
12+ internal_port = 8080
13+ force_https = true
14+ auto_stop_machines = 'stop'
15+ auto_start_machines = true
16+ min_machines_running = 0
17+ processes = ['app']
18+19+[[vm]]
20+ memory = '512mb'
21+ cpu_kind = 'shared'
22+ cpus = 1
+8
server/.env.example
···3# Or the server will generate one on first run and print it to console
4SECRET_KEY_BASE=CHANGE_ME_TO_A_RANDOM_64_CHARACTER_STRING
5000000006# OAuth Configuration
7# These values will be used if environment variables are not set
8
···3# Or the server will generate one on first run and print it to console
4SECRET_KEY_BASE=CHANGE_ME_TO_A_RANDOM_64_CHARACTER_STRING
56+# Server Configuration
7+# Host address to bind to (defaults to 127.0.0.1 if not set)
8+# Use 0.0.0.0 to listen on all interfaces (required for Docker/production)
9+HOST=127.0.0.1
10+11+# Port the server will listen on (defaults to 3000 if not set)
12+PORT=3000
13+14# OAuth Configuration
15# These values will be used if environment variables are not set
16