-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
860 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,20 @@ | ||
FROM ubuntu | ||
|
||
RUN apt-get update | ||
|
||
RUN apt-get install -y \ | ||
curl \ | ||
clang \ | ||
gcc \ | ||
g++ \ | ||
zlib1g-dev \ | ||
libmpc-dev \ | ||
libmpfr-dev \ | ||
libgmp-dev \ | ||
git \ | ||
cmake \ | ||
pkg-config \ | ||
libssl-dev \ | ||
build-essential | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y | ||
|
||
ENV PATH=/root/.cargo/bin:${PATH} | ||
|
||
RUN cargo install sqlx-cli | ||
|
||
WORKDIR /opt | ||
|
||
COPY Cargo.toml Cargo.toml | ||
|
||
COPY Cargo.lock Cargo.lock | ||
|
||
RUN mkdir src && echo "fn main() {}" > src/main.rs | ||
|
||
RUN cargo build --release --locked | ||
|
||
RUN rm -rf src | ||
|
||
COPY src src | ||
|
||
RUN cargo build --release --locked | ||
|
||
COPY migrations migrations | ||
|
||
CMD sqlx database create && sqlx migrate run && cargo run --release --locked | ||
# Leveraging the pre-built Docker images with | ||
# cargo-chef and the Rust toolchain | ||
FROM lukemathwalker/cargo-chef:latest-rust-1.74.0 AS chef | ||
WORKDIR /app | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
# Build dependencies - this is the caching Docker layer! | ||
RUN cargo chef cook --recipe-path recipe.json | ||
|
||
COPY . . | ||
RUN cargo build | ||
|
||
FROM rust:1.74-slim AS template-rust | ||
COPY --from=builder /app/target/debug/template-rust /usr/local/bin | ||
ENTRYPOINT ["/usr/local/bin/template-rust"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: '3' | ||
services: | ||
app: | ||
build: | ||
context: . | ||
target: template-rust | ||
environment: | ||
- PORT=80 | ||
ports: | ||
- "127.0.0.1:8080:3011" |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.