Skip to content

Commit a3aede9

Browse files
committed
corrects dockerfile to always use buildx and corrects binary not found errror.
1 parent a1cfa2b commit a3aede9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
# Stage 1: Build Rust app on platform-specific image
44
FROM --platform=${BUILDPLATFORM} rust:bullseye AS builder
55

6+
# Install required build tools
67
RUN apt-get update && apt-get install -y \
78
build-essential bash pkg-config libssl-dev libpq-dev curl git \
89
--no-install-recommends && rm -rf /var/lib/apt/lists/*
910

1011
WORKDIR /usr/src/app
1112

13+
# Copy workspace and packages
1214
COPY Cargo.toml Cargo.lock ./
1315
COPY ./entity/Cargo.toml ./entity/Cargo.toml
1416
COPY ./entity_api/Cargo.toml ./entity_api/Cargo.toml
@@ -17,25 +19,30 @@ COPY ./service/Cargo.toml ./service/Cargo.toml
1719
COPY ./web/Cargo.toml ./web/Cargo.toml
1820
COPY . .
1921

22+
# Build release binaries for the current platform only
2023
RUN cargo build --release --workspace
2124

22-
# Stage 2: Minimal runtime image using non-root user
25+
# Stage 2: Minimal runtime image
2326
FROM debian:bullseye-slim
2427

28+
# Install Bash to support entrypoint.sh
2529
RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/*
2630

31+
# Create non-root user
2732
RUN useradd -m -s /bin/bash appuser
2833
WORKDIR /app
2934

35+
# Copy only the necessary release binaries
3036
COPY --from=builder /usr/src/app/target/release/refactor_platform_rs .
3137
COPY --from=builder /usr/src/app/target/release/migration .
3238
COPY --from=builder /usr/src/app/target/release/seed_db .
3339

40+
# Copy entrypoint script and make it executable
3441
COPY entrypoint.sh /entrypoint.sh
3542
RUN chmod +x /entrypoint.sh && chown -R appuser:appuser /app /entrypoint.sh
3643

3744
USER appuser
3845

3946
EXPOSE 8000
4047

41-
ENTRYPOINT ["/entrypoint.sh"]
48+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)