@@ -36,7 +36,9 @@ RUN mkdir -p src/bin && \
3636 echo "fn main() {}" > build.rs
3737
3838RUN cargo fetch
39- RUN cargo build --release
39+
40+ ARG PROFILE=release
41+ RUN cargo build --profile=$PROFILE
4042
4143# Dependencies are now cached, copy the actual source code and do another full
4244# build. The touch on all the .rs files is needed, otherwise cargo assumes the
@@ -54,7 +56,7 @@ COPY assets assets/
5456COPY .sqlx .sqlx/
5557COPY migrations migrations/
5658
57- RUN cargo build --release
59+ RUN cargo build --profile=$PROFILE
5860
5961# #####################
6062# Web server stage #
@@ -69,7 +71,8 @@ RUN apt-get update \
6971 tini \
7072 && rm -rf /var/lib/apt/lists/*
7173
72- COPY --from=build /build/target/release/cratesfyi /usr/local/bin
74+ ARG PROFILE_DIR=release
75+ COPY --from=build /build/target/$PROFILE_DIR/cratesfyi /usr/local/bin
7376COPY static /srv/docsrs/static
7477COPY templates /srv/docsrs/templates
7578COPY vendor /srv/docsrs/vendor
@@ -96,7 +99,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
9699
97100RUN mkdir -p /opt/docsrs/prefix
98101
99- COPY --from=build /build/target/release/cratesfyi /usr/local/bin
102+ ARG PROFILE_DIR=release
103+ COPY --from=build /build/target/$PROFILE_DIR/cratesfyi /usr/local/bin
100104COPY static /opt/docsrs/static
101105COPY templates /opt/docsrs/templates
102106COPY dockerfiles/entrypoint.sh /opt/docsrs/
0 commit comments