Skip to content

Commit 017d87c

Browse files
chore: bottlecap alpine without fips
1 parent af60dfd commit 017d87c

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

images/Dockerfile.bottlecap.alpine.compile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
FROM registry.ddbuild.io/images/mirror/alpine:3.16 AS compiler
22
ARG PLATFORM
33

4-
# FIPS is not used for now.
54
ARG 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

109
SHELL ["/bin/bash", "-c"]
1110

@@ -21,15 +20,26 @@ RUN rustup component add rust-src --toolchain stable-$PLATFORM-unknown-linux-mus
2120
# Copy source code
2221
RUN mkdir -p /tmp/dd
2322
COPY ./bottlecap/src /tmp/dd/bottlecap/src
23+
COPY ./bottlecap/build.rs /tmp/dd/bottlecap/build.rs
2424
COPY ./bottlecap/Cargo.toml /tmp/dd/bottlecap/Cargo.toml
2525
COPY ./bottlecap/Cargo.lock /tmp/dd/bottlecap/Cargo.lock
2626

2727
# Build the binary
2828
#
2929
# Added `-C link-arg=-lgcc` for alpine.
3030
ENV 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+
3134
WORKDIR /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;
3343
RUN 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

Comments
 (0)