FROM rust:alpine

WORKDIR /usr/src/app

RUN apk add git musl-dev

COPY public/ public/
COPY void-be/ void-be/

# We don't need all the front end directory files
RUN mkdir void-fe
COPY void-fe/src/ void-fe/src/
COPY void-fe/data/ void-fe/data/
COPY void-fe/Cargo.toml void-fe/Cargo.toml

COPY src/ src/
COPY templates/ templates/
COPY Cargo.toml .
COPY Rocket.toml .

RUN cargo install --config "net.git-fetch-with-cli=true" --path .

ENV RUST_ADDRESS=0.0.0.0

CMD ["cargo", "run", "--release"]
