Skip to content

Commit

Permalink
trying fl0 deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
PXNX committed Nov 28, 2023
1 parent 97b21ef commit 5e51540
Show file tree
Hide file tree
Showing 4 changed files with 860 additions and 62 deletions.
64 changes: 20 additions & 44 deletions Dockerfile
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"]
10 changes: 10 additions & 0 deletions docker-compose.yaml
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"
17 changes: 0 additions & 17 deletions docker-compose.yml

This file was deleted.

Loading

0 comments on commit 5e51540

Please sign in to comment.