Init
This commit is contained in:
commit
ce49c3df81
29 changed files with 3466 additions and 0 deletions
44
Dockerfile
Normal file
44
Dockerfile
Normal file
|
@ -0,0 +1,44 @@
|
|||
FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.69.0 as chef
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
# hadolint ignore=DL3008,DL3009
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
wget \
|
||||
software-properties-common \
|
||||
clang
|
||||
WORKDIR /tmp
|
||||
ARG MOLD_VERSION="1.11.0"
|
||||
RUN wget -qO- https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-x86_64-linux.tar.gz | tar xzf - \
|
||||
&& cp -RT ./mold-${MOLD_VERSION}-x86_64-linux /usr \
|
||||
&& rm -rf ./mold-${MOLD_VERSION}-x86_64-linux
|
||||
WORKDIR /
|
||||
|
||||
FROM chef as diesel
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
FROM chef as planner
|
||||
WORKDIR /usr/src/fiddle
|
||||
RUN mkdir src && touch src/main.rs
|
||||
COPY ./Cargo.toml ./Cargo.lock ./
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef as builder
|
||||
WORKDIR /usr/src/fiddle
|
||||
COPY ./.cargo ./.cargo
|
||||
COPY --from=planner /usr/src/fiddle/recipe.json .
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
COPY ./assets ./assets
|
||||
COPY ./src ./src
|
||||
RUN cargo build --release
|
||||
|
||||
FROM docker.io/bitnami/minideb:bullseye as runner
|
||||
RUN install_packages libpq5
|
||||
WORKDIR /usr/local/bin
|
||||
COPY --from=diesel /usr/local/cargo/bin/diesel .
|
||||
WORKDIR /usr/src/fiddle
|
||||
COPY ./run.sh .
|
||||
RUN chmod +x ./run.sh
|
||||
COPY ./migrations ./migrations
|
||||
COPY --from=builder /usr/src/fiddle/target/release/fiddle ./bin/fiddle
|
||||
EXPOSE 80
|
||||
CMD [ "./run.sh" ]
|
Reference in a new issue