@@ -36,7 +36,9 @@ RUN mkdir -p src/bin && \
36
36
echo "fn main() {}" > build.rs
37
37
38
38
RUN cargo fetch
39
- RUN cargo build --release
39
+
40
+ ARG PROFILE=release
41
+ RUN cargo build --profile=$PROFILE
40
42
41
43
# Dependencies are now cached, copy the actual source code and do another full
42
44
# build. The touch on all the .rs files is needed, otherwise cargo assumes the
@@ -54,7 +56,7 @@ COPY assets assets/
54
56
COPY .sqlx .sqlx/
55
57
COPY migrations migrations/
56
58
57
- RUN cargo build --release
59
+ RUN cargo build --profile=$PROFILE
58
60
59
61
# #####################
60
62
# Web server stage #
@@ -69,7 +71,8 @@ RUN apt-get update \
69
71
tini \
70
72
&& rm -rf /var/lib/apt/lists/*
71
73
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
73
76
COPY static /srv/docsrs/static
74
77
COPY templates /srv/docsrs/templates
75
78
COPY vendor /srv/docsrs/vendor
@@ -96,7 +99,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
96
99
97
100
RUN mkdir -p /opt/docsrs/prefix
98
101
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
100
104
COPY static /opt/docsrs/static
101
105
COPY templates /opt/docsrs/templates
102
106
COPY dockerfiles/entrypoint.sh /opt/docsrs/
0 commit comments