Gnosco is a Rust-based escrow and badging application that integrates with the AT Protocol ecosystem..
1# Build stage
2FROM rust:1.90-slim-bookworm AS builder
3
4# Install required system dependencies for building
5RUN apt-get update && apt-get install -y \
6 pkg-config \
7 libssl-dev \
8 && rm -rf /var/lib/apt/lists/*
9
10# Set working directory
11WORKDIR /app
12
13# Copy manifests first for better layer caching
14COPY Cargo.toml Cargo.lock build.rs ./
15
16ARG TEMPLATES=./templates
17ARG STATIC=./static
18ARG GIT_HASH=0
19ENV GIT_HASH=$GIT_HASH
20
21# Copy actual source code and assets
22COPY src ./src
23COPY ${TEMPLATES} ./templates
24COPY i18n ./i18n
25COPY ${STATIC} ./static
26
27ENV HTTP_TEMPLATE_PATH=/app/templates/
28
29# Build the actual application with embed feature only
30RUN cargo build --release --no-default-features --features embed
31
32# Runtime stage using distroless
33FROM gcr.io/distroless/cc-debian12
34
35# Add OCI labels
36LABEL org.opencontainers.image.title="gnosco"
37LABEL org.opencontainers.image.description="A badging application."
38LABEL org.opencontainers.image.version="0.1.0"
39LABEL org.opencontainers.image.authors="Nick Gerakines <nick.gerakines@gmail.com>"
40LABEL org.opencontainers.image.url="https://gnosco.events/"
41LABEL org.opencontainers.image.source="https://tangled.sh/@smokesignal.events/gnosco"
42LABEL org.opencontainers.image.licenses="MIT"
43LABEL org.opencontainers.image.created="2025-01-06T00:00:00Z"
44
45# Set working directory
46WORKDIR /app
47
48# Copy the binary from builder stage
49COPY --from=builder /app/target/release/gnosco /app/gnosco
50
51# Copy static directory
52COPY --from=builder /app/static ./static
53
54# Set environment variables
55ENV HTTP_STATIC_PATH=/app/static
56ENV HTTP_PORT=8080
57
58# Expose port
59EXPOSE 8080
60
61ARG RECORDS=./records.json
62COPY ${RECORDS} /records.json
63
64ENV RECORD_SOURCE=/records.json
65
66# Run the application
67ENTRYPOINT ["/app/gnosco"]