slack status without the slack
status.zzstoatzz.io/
quickslice
1# Building from source because ghcr.io/bigmoves/quickslice:latest still points
2# to v0.17.2, which lacks the `sub` claim fix needed for OAuth token response.
3# Once :latest is updated to v0.17.3+, this can be simplified to:
4# FROM ghcr.io/bigmoves/quickslice:latest
5#
6# This Dockerfile is adapted from https://github.com/bigmoves/quickslice/blob/main/Dockerfile
7
8ARG GLEAM_VERSION=v1.13.0
9
10# Build stage - compile the application
11FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine AS builder
12
13# Install build dependencies (including PostgreSQL client for multi-database support)
14RUN apk add --no-cache \
15 bash \
16 git \
17 nodejs \
18 npm \
19 build-base \
20 sqlite-dev \
21 postgresql-dev
22
23# Configure git for non-interactive use
24ENV GIT_TERMINAL_PROMPT=0
25
26# Clone quickslice at the v0.17.3 tag (includes sub claim fix)
27RUN git clone --depth 1 --branch v0.17.3 https://github.com/bigmoves/quickslice.git /build
28
29# Install dependencies for all projects
30RUN cd /build/client && gleam deps download
31RUN cd /build/lexicon_graphql && gleam deps download
32RUN cd /build/server && gleam deps download
33
34# Apply patches to dependencies
35RUN cd /build && patch -p1 < patches/mist-websocket-protocol.patch
36
37# Install JavaScript dependencies for client
38RUN cd /build/client && npm install
39
40# Compile the client code and output to server's static directory
41RUN cd /build/client \
42 && gleam add --dev lustre_dev_tools \
43 && gleam run -m lustre/dev build quickslice_client --minify --outdir=/build/server/priv/static
44
45# Compile the server code
46RUN cd /build/server \
47 && gleam export erlang-shipment
48
49# Runtime stage - slim image with only what's needed to run
50FROM ghcr.io/gleam-lang/gleam:${GLEAM_VERSION}-erlang-alpine
51
52# Install runtime dependencies and dbmate for migrations
53ARG TARGETARCH
54RUN apk add --no-cache sqlite-libs sqlite libpq curl \
55 && DBMATE_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "arm64" || echo "amd64") \
56 && curl -fsSL -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/releases/latest/download/dbmate-linux-${DBMATE_ARCH} \
57 && chmod +x /usr/local/bin/dbmate
58
59# Copy the compiled server code from the builder stage
60COPY --from=builder /build/server/build/erlang-shipment /app
61
62# Copy database migrations and config
63COPY --from=builder /build/server/db /app/db
64COPY --from=builder /build/server/.dbmate.yml /app/.dbmate.yml
65COPY --from=builder /build/server/docker-entrypoint.sh /app/docker-entrypoint.sh
66
67# Set up the entrypoint
68WORKDIR /app
69
70# Create the data directory for the SQLite database and Fly.io volume mount
71RUN mkdir -p /data && chmod 755 /data
72
73# Set environment variables
74ENV HOST=0.0.0.0
75ENV PORT=8080
76
77# Expose the port the server will run on
78EXPOSE $PORT
79
80# Run the server
81CMD ["/app/docker-entrypoint.sh", "run"]