Commit
Author: Kevin Schoon [me@kevinschoon.com]
Hash: 835b2fd024be299bdfc2ccd1198729f0d3bc2ae9
Timestamp: Fri, 05 Jul 2024 23:48:51 +0000 (5 months ago)

+15 -18 +/-3 browse
cache target directories when building ayllu components
1diff --git a/containers/ayllu/Containerfile b/containers/ayllu/Containerfile
2index 83f726a..84d9388 100644
3--- a/containers/ayllu/Containerfile
4+++ b/containers/ayllu/Containerfile
5 @@ -47,29 +47,32 @@ WORKDIR /src/ayllu
6
7 RUN npm install
8
9- RUN --mount=type=cache,target=/root/.cargo \
10+ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/src/ayllu/target \
11 scripts/check_build_dependencies.sh || true
12
13- RUN --mount=type=cache,target=/root/.cargo \
14+ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/src/ayllu/target \
15 scripts/ensure_database.sh ayllu
16
17 # cache all Ayllu dependencies required for the build
18 RUN --mount=type=cache,target=/root/.cargo cargo fetch --color=never --locked
19
20 # build the main ayllu binary
21- RUN --mount=type=cache,target=/root/.cargo --network=none \
22+ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/src/ayllu/target --network=none \
23 cargo build \
24- --color=never --locked --frozen --offline --release --package ayllu
25+ --color=never --locked --frozen --offline --release --package ayllu \
26+ && mv /src/ayllu/target/release/ayllu /
27
28 # build the ayllu-mail binary
29- RUN --mount=type=cache,target=/root/.cargo --network=none \
30+ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/src/ayllu/target --network=none \
31 cargo build \
32- --color=never --locked --frozen --offline --release --package ayllu-mail
33+ --color=never --locked --frozen --offline --release --package ayllu-mail \
34+ && mv /src/ayllu/target/release/ayllu-mail /
35
36 # build the quipu binary
37- RUN --mount=type=cache,target=/root/.cargo --network=none \
38+ RUN --mount=type=cache,target=/root/.cargo --mount=type=cache,target=/src/ayllu/target --network=none \
39 cargo build \
40- --color=never --locked --frozen --offline --release --package quipu
41+ --color=never --locked --frozen --offline --release --package quipu \
42+ && mv /src/ayllu/target/release/quipu /
43
44 FROM alpine:3
45
46 @@ -81,9 +84,9 @@ RUN apk add \
47 RUN rm -v /usr/lib/libtree-sitter-cpp.so
48
49 COPY --from=build --chown=0:0 /usr/bin/rudolfs /usr/bin/
50- COPY --from=build --chown=0:0 /src/ayllu/target/release/ayllu /usr/bin/
51- COPY --from=build --chown=0:0 /src/ayllu/target/release/ayllu-mail /usr/bin/
52- COPY --from=build --chown=0:0 /src/ayllu/target/release/quipu /usr/bin/
53+ COPY --from=build --chown=0:0 /ayllu /usr/bin/
54+ COPY --from=build --chown=0:0 /ayllu-mail /usr/bin/
55+ COPY --from=build --chown=0:0 /quipu /usr/bin/
56 COPY --from=build --chown=0:0 /src/ayllu/ayllu/themes /usr/lib/ayllu/themes
57 COPY --from=build --chown=0:0 /src/ayllu/ayllu/migrations /usr/lib/ayllu/migrations/ayllu
58 COPY --from=build --chown=0:0 /src/ayllu/LICENSE /usr/share/licenses/ayllu/
59 diff --git a/containers/multiuser/init/config.sh b/containers/multiuser/init/config.sh
60index 57f51e5..31b993d 100755
61--- a/containers/multiuser/init/config.sh
62+++ b/containers/multiuser/init/config.sh
63 @@ -4,4 +4,4 @@
64 # at runtime e.g. ayllu config set http.address = ....
65 [ -n "${AYLLU_LISTEN_ADDRESS}" ] && {
66 sed -i "s/127.0.0.1:8080/$AYLLU_LISTEN_ADDRESS/" /etc/ayllu/config.toml
67- }
68+ } || true
69 diff --git a/containers/multiuser/init/users.sh b/containers/multiuser/init/users.sh
70index aece463..8d1a791 100755
71--- a/containers/multiuser/init/users.sh
72+++ b/containers/multiuser/init/users.sh
73 @@ -57,9 +57,3 @@ do
74 addgroup ayllu "$username"
75
76 done
77-
78- # TODO: Ayllu should have a programmatic way to set configuration values
79- # at runtime e.g. ayllu config set http.address = ....
80- [ -n "${AYLLU_LISTEN_ADDRESS}" ] && {
81- sed -i "s/127.0.0.1:8080/$AYLLU_LISTEN_ADDRESS/" /etc/ayllu/config.toml
82- }