@@ -4,7 +4,8 @@ ARG GO_VERSION=1.24.5
44ARG ONNXRUNTIME_VERSION=1.22.0
55ARG BUILD_PLATFORM=linux/amd64
66
7- # --- runtime layer with all hugot dependencies for cpu ---
7+ # --- runtime layer with all hugot dependencies for cpu
8+ # --- the image generated does not contain the hugot code, only the dependencies needed by hugot and the compiled cli binary
89
910FROM --platform=$BUILD_PLATFORM public.ecr.aws/amazonlinux/amazonlinux:2023 AS hugot-runtime
1011ARG GO_VERSION
@@ -39,27 +40,9 @@ RUN --mount=src=./go.mod,dst=/go.mod \
3940 useradd -u 1000 -m testuser && usermod -a -G wheel testuser && \
4041 echo "testuser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/testuser
4142
42- # --- test layer ---
43-
44- FROM --platform=$BUILD_PLATFORM hugot-runtime AS hugot-build
45-
4643COPY . /build
47-
4844RUN cd /build && \
4945 chown -R testuser:testuser /build && \
5046 # cli binary
5147 cd /build/cmd && CGO_ENABLED=1 CGO_LDFLAGS="-L/usr/lib/" GOOS=linux GOARCH=amd64 go build -tags "ALL" -a -o /cli main.go && \
52- cd / && \
53- curl -LO https://github.com/gotestyourself/gotestsum/releases/download/v1.12.0/gotestsum_1.12.0_linux_amd64.tar.gz && \
54- tar -xzf gotestsum_1.12.0_linux_amd64.tar.gz --directory /usr/local/bin && \
55- # entrypoint
56- cp /build/scripts/entrypoint.sh /entrypoint.sh && sed -i 's/\r //g' /entrypoint.sh && chmod +x /entrypoint.sh
57-
58- ENTRYPOINT ["/entrypoint.sh" ]
59-
60- # --- artifacts layer ---
61- FROM --platform=$BUILD_PLATFORM scratch AS artifacts
62-
63- COPY --from=hugot-build /usr/lib64/onnxruntime.so onnxruntime-linux-x64.so
64- COPY --from=hugot-build /usr/lib/libtokenizers.a libtokenizers.a
65- COPY --from=hugot-build /cli /hugot-cli-linux-x64
48+ cd / && rm -rf /build
0 commit comments