A Rust application to showcase badge awards in the AT Protocol ecosystem.
1# Build stage
2FROM rust:1.87-slim 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 FEATURES=embed,postgres,s3
17ARG TEMPLATES=./templates
18ARG STATIC=./static
19
20# Copy actual source code and assets
21COPY src ./src
22COPY ${TEMPLATES} ./templates
23COPY ${STATIC} ./static
24
25ENV HTTP_TEMPLATE_PATH=/app/templates/
26
27# Build the actual application with embed feature only
28RUN cargo build --release --no-default-features --features ${FEATURES}
29
30# Runtime stage using distroless
31FROM gcr.io/distroless/cc-debian12
32
33# Add OCI labels
34LABEL org.opencontainers.image.title="showcase"
35LABEL org.opencontainers.image.description="An application showcases awarded badges."
36LABEL org.opencontainers.image.version="0.1.0"
37LABEL org.opencontainers.image.authors="Nick Gerakines <nick.gerakines@gmail.com>"
38LABEL org.opencontainers.image.url="https://badges.smokesignal.events/"
39LABEL org.opencontainers.image.source="https://tangled.sh/@smokesignal.events/showcase"
40LABEL org.opencontainers.image.licenses="MIT"
41LABEL org.opencontainers.image.created="2025-01-06T00:00:00Z"
42
43# Set working directory
44WORKDIR /app
45
46# Copy the binary from builder stage
47COPY --from=builder /app/target/release/showcase /app/showcase
48
49# Copy static directory
50COPY --from=builder /app/static ./static
51
52# Set environment variables
53ENV HTTP_STATIC_PATH=/app/static
54ENV HTTP_PORT=8080
55
56# Expose port
57EXPOSE 8080
58
59# Run the application
60ENTRYPOINT ["/app/showcase"]