FROM ubuntu:24.04

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

RUN apt update
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y gcc gcc-multilib pkg-config libssl-dev curl mysql-client-8.0 npm
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain nightly

WORKDIR /usr/src/reminder-rs

# Docker is shit
COPY ./.sqlx ./.sqlx
COPY ./assets ./assets
COPY ./conf ./conf
COPY ./extract_derive ./extract_derive
COPY ./migrations ./migrations
COPY ./recordable_derive ./recordable_derive
COPY ./reminder-dashboard/public ./reminder-dashboard/public
COPY ./reminder-dashboard/src ./reminder-dashboard/src
COPY ./reminder-dashboard/index.html ./reminder-dashboard/
COPY ./reminder-dashboard/package.json ./reminder-dashboard/
COPY ./reminder-dashboard/package-lock.json ./reminder-dashboard/
COPY ./reminder-dashboard/tsconfig.json ./reminder-dashboard/
COPY ./reminder-dashboard/vite.config.ts ./reminder-dashboard/
COPY ./src ./src
COPY ./static ./static
COPY ./templates ./templates
COPY ./build.rs ./
COPY ./Cargo.lock ./
COPY ./Cargo.toml ./
COPY ./dp.py ./

RUN cargo install --path .

CMD ["reminder-rs"]
