-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
40 lines (30 loc) · 1.38 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Stage 1: Builder
# Using the latest Rust image to set up the build environment
FROM rust:1.80 AS builder
SHELL ["/bin/bash", "-c"]
WORKDIR /usr/src/scout
# Copy and set permissions for the entrypoint script
COPY entrypoint.sh /usr/src/scout/entrypoint.sh
# Copy local cargo-scout-audit project files
COPY /apps/cargo-scout-audit /usr/src/scout/cargo-scout-audit
# Install cargo-scout-audit from the local path
RUN cargo install --path /usr/src/scout/cargo-scout-audit --locked
# Stage 2: Final
# Base image with Rust slim version for the runtime environment
FROM rust:1.80-slim AS final
# Install only necessary runtime dependencies
RUN apt-get update && apt-get install -y libcurl4 libssl-dev pkg-config && \
rm -rf /var/lib/apt/lists/*
# Copy the .rustup directory from the builder stage
COPY --from=builder /usr/local/rustup /usr/local/rustup
ENV PATH="/usr/local/rustup/bin:$PATH"
# Copy necessary binaries from the builder stage
COPY --from=builder /usr/local/cargo/bin/cargo-scout-audit /usr/local/cargo/bin/
COPY --from=builder /usr/local/cargo/bin/dylint-link /usr/local/cargo/bin/
COPY --from=builder /usr/src/scout/entrypoint.sh /usr/local/bin/
# Ensure the script and binaries are executable
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/cargo/bin/*
# Define volume for application data
VOLUME /scoutme
# Set the entrypoint to the script
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]