containeryard 0.3.13

Container Yard is a declarative, reproducible, and reusable decentralized approach for defining containers. Think Nix flakes meets Containerfiles (aka Dockerfiles).
####  22_04: bases/ubuntu/android/22_04.md  ####

### Android
# https://github.com/thyrlian/AndroidSDK
FROM thyrlian/android-sdk:9.3

RUN apt-get update -y \
    && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends --no-install-suggests ca-certificates \
    && update-ca-certificates

####  android_sdk: dependent/android_sdk/developer_tools.md  ####

# https://docs.flutter.dev/reference/supported-platforms
# https://developer.android.com/tools/releases/platform-tools

## For all the latest configs use `sdkmanager --list`

# https://developer.android.com/tools/releases/platforms
# e.g. "android-34"
ARG android_platform=android-34 
# https://developer.android.com/tools/releases/build-tools
# e.g. "34.0.0"
ARG android_build_tools=34.0.0

# Update the SDK manager and install necessary Android SDK components https://developer.android.com/tools/sdkmanager
RUN sdkmanager --update \
    && sdkmanager \
        # Install the Android SDK for the specified platform version (API level).
        "platforms;${android_platform}" \
        # Install platform-tools like adb (Android Debug Bridge)
        # This appear to not take a version
        "platform-tools" \
        # Install the specified version of build tools for compiling Android apps
        "build-tools;${android_build_tools}" \
        # Install the latest version of command-line tools for general SDK management tasks
        "cmdline-tools;latest"
        ## Extra
        # Install the latest version of the NDK (Native Development Kit) for compiling native code. Cant use "latest" here
        #"ndk;26.2.11394342"
        # Install the latest version of CMake. Cant use "latest" here
        #"cmake;3.22.1"

####  flutter: dependent/apt/flutter/latest.md  ####

ARG flutter_ver=3.24.4

## Set environment variables
ENV FLUTTER_HOME=/usr/local/flutter
ENV PATH ${PATH}:${FLUTTER_HOME}/bin:${FLUTTER_HOME}/bin/cache/dart-sdk/bin:${HOME}/.pub-cache/bin
# Needed for linux, sets x11 to use the first display, use `export GDK_BACKEND=wayland` to use wayland
ENV DISPLAY=:0



RUN mkdir -p $FLUTTER_HOME \
## Base linux config
    && apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends --no-install-suggests ca-certificates \
    && update-ca-certificates \

## Install base tools required flutter tools https://docs.flutter.dev/get-started/install/linux#system-requirements
    && apt-get install -y --no-install-recommends --no-install-suggests \
    bash \
    curl \
    file \
    git \
    # mkdir \
    # rm \
    unzip \
    # which \
    xz-utils \
    zip \

## For linux desktop apps: https://docs.flutter.dev/get-started/install/linux#linux-prerequisites
    && apt-get install -y --no-install-recommends --no-install-suggests \
    clang \
    cmake \
    git \
    ninja-build \
    pkg-config \
    libgtk-3-dev \
    liblzma-dev \
    libstdc++-12-dev \

## Linux downloads https://docs.flutter.dev/release/archive?tab=linux
## Download Flutter, extract it to the FLUTTER_HOME directory, and then remove the original file
    && curl -O https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${flutter_ver}-stable.tar.xz \
    && tar xf flutter_linux_${flutter_ver}-stable.tar.xz -C $FLUTTER_HOME --strip-components=1 \
    && rm flutter_linux_${flutter_ver}-stable.tar.xz \

## `flutter config` fails without this
    && git config --global --add safe.directory /usr/local/flutter \

## Setup Flutter
    && flutter config --enable-android \
                --enable-linux-desktop \
                --enable-web \
                --enable-ios \
                --enable-macos-desktop \
                --enable-windows-desktop \

## Pre-fetch Flutter development binaries
    && flutter precache --universal \
    --linux \
    --web \
    --ios \
    --macos \
    --windows \

## Accept Android licenses
    && yes | flutter doctor --android-licenses \

## Linux
### Install Chrome (Used by Flutter Web)
    && apt-get install -y wget \
    && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
    && apt-get install -y ./google-chrome-stable_current_amd64.deb \

## Create a google chrome executable that allows running as root. Used by flutter when lauching web apps.
    && ORIGINAL_CHROME_PATH=$(which google-chrome) \
    && mv "$ORIGINAL_CHROME_PATH" "${ORIGINAL_CHROME_PATH}-bin" \
    && echo '#!/bin/bash\n'"${ORIGINAL_CHROME_PATH}-bin"' --no-sandbox --headless "$@"' > /usr/bin/google-chrome \
    && chmod +x /usr/bin/google-chrome \

## Need for packages
# Needed by path provider find the write paths for the linux os
    && apt-get install xdg-user-dirs

####  rust: dependent/apt/rust/nightly.md  ####

# Based off: https://github.com/rust-lang/docker-rust/blob/9f287282d513a84cb7c7f38f197838f15d37b6a9/nightly/bookworm/slim/Dockerfile

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH \
    RUST_VERSION=nightly

RUN set -eux; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ca-certificates \
        gcc \
        libc6-dev \
        wget \
        ; \
    dpkgArch="$(dpkg --print-architecture)"; \
    case "${dpkgArch##*-}" in \
        amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d' ;; \
        armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \
        arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \
        i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \
        ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='079430f58ad4da1d1f4f5f2f0bd321422373213246a93b3ddb53dad627f5aa38' ;; \
        s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e7f89da453c8ce5771c28279d1a01d5e83541d420695c74ec81a7ec5d287c51c' ;; \
        *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
    esac; \
    url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \
    wget "$url"; \
    echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
    chmod +x rustup-init; \
    ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
    rm rustup-init; \
    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
    rustup --version; \
    cargo --version; \
    rustc --version; \
    apt-get remove -y --auto-remove \
        wget \
        ;
    # Make sure to remove trailing `\` when you copy over a new version.
    # rm -rf /var/lib/apt/lists/*;

####  rust_essentials: dependent/apt/rust/essentials.md  ####

# libssl-dev: Needed for openssl certificates (may need to add the pkg files to PKG_CONFIG_PATH)
# libasound2-dev: Needed for alsa (may need to add the pkg files to PKG_CONFIG_PATH)
# pkg-config: Quering local libraries for compilation. Needed by rustc.
RUN apt-get update && apt install -y libssl-dev libasound2-dev pkg-config

####  git: dependent/apt/git.md  ####

RUN apt install -y git

####  git_config: dependent/git/git_config.md  ####

RUN git config --global user.name mcmah309 && \
    git config --global user.email dillonmcmahon79@gmail.com

####  bash_flavor: dependent/apt/bash_interactive/flavors/mcmah309/mcmah309.md  ####

COPY ./setup_bash.sh /tmp/
RUN chmod +x /tmp/setup_bash.sh && /tmp/setup_bash.sh && rm /tmp/setup_bash.sh

####  finalizer: local_modules/finalizer.md  ####

RUN mkdir -p /app

WORKDIR /app
VOLUME /app

# Runs until the container is stopped
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["tail -f /dev/null"]