11FROM registry.ddbuild.io/images/mirror/alpine:3.16 AS compiler
22ARG PLATFORM
33
4- # FIPS is not used for now.
54ARG FIPS
65
76# Install dependencies
8- RUN apk add --no-cache curl gcc musl-dev make unzip bash autoconf automake libtool g++
7+ RUN apk add --no-cache curl gcc musl-dev make unzip bash autoconf automake libtool g++ go cmake linux-headers clang
98
109SHELL ["/bin/bash", "-c"]
1110
@@ -21,15 +20,26 @@ RUN rustup component add rust-src --toolchain stable-$PLATFORM-unknown-linux-mus
2120# Copy source code
2221RUN mkdir -p /tmp/dd
2322COPY ./bottlecap/src /tmp/dd/bottlecap/src
23+ COPY ./bottlecap/build.rs /tmp/dd/bottlecap/build.rs
2424COPY ./bottlecap/Cargo.toml /tmp/dd/bottlecap/Cargo.toml
2525COPY ./bottlecap/Cargo.lock /tmp/dd/bottlecap/Cargo.lock
2626
2727# Build the binary
2828#
2929# Added `-C link-arg=-lgcc` for alpine.
3030ENV RUSTFLAGS="-C panic=abort -C link-arg=-lgcc"
31+ ENV AWS_LC_FIPS_SYS_CC=clang
32+ ENV AWS_LC_FIPS_SYS_CXX=clang++
33+
3134WORKDIR /tmp/dd/bottlecap
32- RUN --mount=type=cache,target=/root/.cargo/registry cargo +stable build --release --target $PLATFORM-unknown-linux-musl
35+ RUN --mount=type=cache,target=/root/.cargo/registry \
36+ if [ "$FIPS" = "1" ]; then \
37+ export FEATURES=fips; \
38+ else \
39+ export FEATURES=default; \
40+ fi; \
41+ env; \
42+ cargo +stable build --no-default-features --features $FEATURES --release --target $PLATFORM-unknown-linux-musl;
3343RUN cp /tmp/dd/bottlecap/target/$PLATFORM-unknown-linux-musl/release/bottlecap /tmp/dd/bottlecap/bottlecap
3444
3545# Use the smallest image possible
0 commit comments