mentorenwahl/frontend/Dockerfile
Dominic Grimm 860ae7ed5e
All checks were successful
continuous-integration/drone/push Build is passing
Rewrite frontend in rust with yew
2022-11-04 21:23:36 +01:00

27 lines
857 B
Docker

FROM lukemathwalker/cargo-chef:latest-rust-1.65.0 as chef
WORKDIR /usr/src/frontend
FROM chef as planner
WORKDIR /usr/src/frontend
RUN mkdir src && touch src/main.rs
COPY ./Cargo.toml .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef as builder
WORKDIR /usr/local/bin
ARG TRUNK_VERSION="v0.16.0"
RUN wget -qO- https://github.com/thedodd/trunk/releases/download/${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
WORKDIR /usr/src/frontend
RUN rustup target add wasm32-unknown-unknown
COPY ./.cargo ./.cargo
COPY --from=planner /usr/src/frontend/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json
COPY ./index.html .
COPY ./graphql ./graphql
COPY ./src ./src
RUN trunk build --release
FROM nginx:alpine as runner
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /usr/src/frontend/dist /var/www/html