|
1 |
| -FROM babashka/babashka:latest@sha256:4bc4beea38406782845ae8effaa9bd2f45345d46a4290ea4c96037970a0ca430 AS bb |
2 |
| - |
3 |
| -FROM bb AS base |
4 |
| - |
5 |
| -RUN <<EOF |
6 |
| -apt-get update |
7 |
| -apt-get install -y git |
| 1 | +# syntax = docker/dockerfile:1.4 |
| 2 | +FROM nixos/nix:2.21.1@sha256:3f6c77ee4d2c82e472e64e6cd7087241dc391421a0b42c22e6849c586d5398d9 AS builder |
| 3 | + |
| 4 | +WORKDIR /tmp/build |
| 5 | +RUN mkdir /tmp/nix-store-closure |
| 6 | + |
| 7 | +# ignore SC2046 because the output of nix-store -qR will never have spaces - this is safe here |
| 8 | +# hadolint ignore=SC2046 |
| 9 | +RUN --mount=type=cache,target=/nix,from=nixos/nix:2.21.1,source=/nix \ |
| 10 | + --mount=type=cache,target=/root/.cache \ |
| 11 | + --mount=type=bind,target=/tmp/build \ |
| 12 | + <<EOF |
| 13 | + nix \ |
| 14 | + --extra-experimental-features "nix-command flakes" \ |
| 15 | + --option filter-syscalls false \ |
| 16 | + --extra-trusted-substituters "https://cache.iog.io" \ |
| 17 | + --extra-trusted-public-keys "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" \ |
| 18 | + --show-trace \ |
| 19 | + --log-format raw \ |
| 20 | + build . --out-link /tmp/output/result |
| 21 | + cp -R $(nix-store -qR /tmp/output/result) /tmp/nix-store-closure |
8 | 22 | EOF
|
9 | 23 |
|
10 |
| -FROM eclipse-temurin:latest@sha256:ac1545309de7e27001a80d91df2d42865c0bacaec75e016cb4482255d7691187 AS build |
11 |
| - |
12 |
| -WORKDIR /app |
13 |
| - |
14 |
| -COPY --from=bb /usr/local/bin/bb /usr/local/bin/bb |
15 |
| -COPY bb.edn bb.edn |
16 |
| -COPY ./src ./src |
17 |
| -RUN bb uberjar prompts.jar -m prompts |
18 |
| - |
19 |
| -FROM base |
| 24 | +FROM scratch |
20 | 25 |
|
21 | 26 | WORKDIR /app
|
22 | 27 |
|
23 |
| -COPY ./extractors/registry.edn ./extractors/registry.edn |
24 |
| -COPY ./functions/registry.edn ./functions/registry.edn |
| 28 | +COPY --from=builder /tmp/nix-store-closure /nix/store |
| 29 | +COPY --from=builder /tmp/output/ /app/ |
25 | 30 |
|
26 |
| -COPY --from=build /app/prompts.jar /app/prompts.jar |
| 31 | +# curl needs the /tmp directory to already exist |
| 32 | +COPY <<EOF /tmp/.blank |
| 33 | +empty |
| 34 | +EOF |
27 | 35 |
|
28 |
| -COPY prompts/docker docker |
29 |
| -COPY prompts/lazy_docker lazy_docker |
| 36 | +COPY <<EOF /root/.blank |
| 37 | +empty |
| 38 | +EOF |
30 | 39 |
|
31 |
| -# Can't be shell form because we need to pass JSON as an arg |
32 |
| -ENTRYPOINT [ "bb", "/app/prompts.jar" ] |
| 40 | +ENTRYPOINT ["/app/result/bin/entrypoint"] |
0 commit comments