Skip to content

Commit 4fcd870

Browse files
committed
enhancement: moving Dockerfiles to docker dir
1 parent 68f9029 commit 4fcd870

File tree

2 files changed

+36
-51
lines changed

2 files changed

+36
-51
lines changed

docker/Dockerfile-web

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Stage 1: Build the Rust application
2+
FROM rust:latest AS builder
3+
4+
# Set the working directory
5+
WORKDIR /usr/src/app
6+
7+
# Copy the local dependencies
8+
COPY ../entity/Cargo.toml entity/
9+
COPY ../entity_api/Cargo.toml entity_api/
10+
11+
# Copy the Cargo.toml and Cargo.lock files to leverage Docker's caching
12+
COPY Cargo.toml Cargo.lock ./
13+
14+
# Fetch the dependencies
15+
RUN cargo fetch
16+
17+
# Copy the source code into the working directory
18+
COPY . .
19+
20+
# Build the application in release mode
21+
RUN cargo build --release
22+
23+
# Stage 2: Create a minimal runtime image
24+
FROM alpine:latest
25+
26+
# Install necessary runtime dependencies
27+
RUN apk add --no-cache libgcc
28+
29+
# Set the working directory
30+
WORKDIR /usr/src/app
31+
32+
# Copy the compiled binary from the builder stage
33+
COPY --from=builder /usr/src/app/target/release/your_binary_name .
34+
35+
# Set the entrypoint to the binary
36+
ENTRYPOINT ["./your_binary_name"]

web/Dockerfile

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)