Skip to content

Commit

Permalink
feat: setup Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Gumichocopengin8 committed Dec 7, 2024
1 parent debd785 commit 4ac086e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
.DS_Store
.env
1 change: 1 addition & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[profile.release]
lto = true
codegen-units = 1
strip = true # same as strip command on Linux
11 changes: 11 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM rust:1.83.0-slim-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev
WORKDIR /app
COPY . .
RUN cargo build --release

FROM amazonlinux:2023
RUN yum install -y openssl openssl-devel
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.4 /lambda-adapter /opt/extensions/lambda-adapter
COPY --from=builder /app/target/release/crate_trends_api /app
CMD ["/app"]
6 changes: 6 additions & 0 deletions api/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
services:
crate_trends_api:
build:
context: . # Dockerfile in the same directory
ports:
- "8080:8080"

0 comments on commit 4ac086e

Please sign in to comment.