-
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
Devesh Rawat
committed
Jan 11, 2024
1 parent
e08b6b9
commit ada7522
Showing
6 changed files
with
80 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.env | ||
target/ | ||
tests/ | ||
Dockerfile | ||
scripts/ | ||
migrations/ |
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
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,8 +1,29 @@ | ||
FROM rust:latest | ||
FROM lukemathwalker/cargo-chef:latest-rust-latest as chef | ||
WORKDIR /app | ||
RUN apt update && apt install lld clang -y | ||
FROM chef as planner | ||
COPY . . | ||
# Compute a lock-like file for our project | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
FROM chef as builder | ||
COPY --from=planner /app/recipe.json recipe.json | ||
# Build our project dependencies, not our application! | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
# Up to this point, if our dependency tree stays the same, | ||
# all layers should be cached. | ||
COPY . . | ||
ENV SQLX_OFFLINE true | ||
RUN cargo build --release | ||
# Build our project | ||
RUN cargo build --release --bin newsLetter | ||
FROM debian:latest AS runtime | ||
WORKDIR /app | ||
RUN apt-get update -y \ | ||
&& apt-get install -y --no-install-recommends openssl ca-certificates \ | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /app/target/release/newsLetter newsLetter | ||
COPY configuration configuration | ||
ENV APP_ENVIRONMENT production | ||
ENTRYPOINT ["./target/release/newsLetter"] | ||
ENTRYPOINT ["./newsLetter"] |
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,23 @@ | ||
version: "3.8" | ||
|
||
services: | ||
newsletter: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8000:8000" # Adjust the port as needed | ||
environment: | ||
- APP_ENVIRONMENT=production | ||
depends_on: | ||
- postgres | ||
command: ["./newsLetter"] | ||
|
||
postgres: | ||
image: postgres:latest | ||
environment: | ||
POSTGRES_DB: newsletter | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
ports: | ||
- "5432:5432" |
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,19 @@ | ||
name: newsLetter | ||
|
||
region: BLR1 | ||
|
||
services: | ||
- name: newsLetter | ||
dockerfile_path: Dockerfile | ||
source_dir: . | ||
github: | ||
branch: main | ||
deploy_on_push: true | ||
repo: PrognosticatorR/news_letter | ||
health_check: | ||
http_path: /health_check | ||
http_port: 8000 | ||
instance_count: 1 | ||
instance_size_slug: basic-xxs | ||
routes: | ||
- path: / |
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