an-anime-team-an-anime-game-launcher
SUCCESS
43m 15s
History Source
SummaryIterations2Transcript32Dockerfile
Dockerfile57 lines · 1626 chars
# Multi-stage Dockerfile to build anime-game-launcher from source and run it with GTK4

# Builder stage: compile from source with the Rust toolchain
FROM rust:1.94.0 AS builder

# Install build dependencies (GTK4 and related tooling, protobuf, OpenSSL for crates that use TLS)
RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        build-essential \
        pkg-config \
        libgtk-4-dev \
        libadwaita-1-dev \
        libglib2.0-dev \
        libgdk-pixbuf-2.0-dev \
        protobuf-compiler \
        cmake \
        git \
        curl \
        libssl-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app

# Copy the entire repository (no pre-cached dependencies)
COPY . .

# Build in release mode
RUN cargo build --release

# Runtime stage: minimal image with only runtime dependencies
FROM ubuntu:22.04 AS runtime

# Install minimal GTK4 runtime and OpenSSL libraries
RUN apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
        libgtk-4-1 \
        libadwaita-1-0 \
        libgdk-pixbuf-2.0-0 \
        libcairo2 \
        libpango-1.0-0 \
        libglib2.0-0 \
        libatk1.0-0 \
        libwayland-client0 \
        libwayland-cursor0 \
        libwayland-egl1 \
        libxcb-shm0 \
        libxcb-render0 \
        libxcb1 \
        libssl3 \
    && rm -rf /var/lib/apt/lists/*

# Copy the built binary from the builder
COPY --from=builder /usr/src/app/target/release/anime-game-launcher /usr/local/bin/anime-game-launcher

# Set the command to run the GUI application
CMD ["/usr/local/bin/anime-game-launcher"]