-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
76 lines (60 loc) · 2.43 KB
/
dockerfile
File metadata and controls
76 lines (60 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Use the official Alpine Linux image as the base image
FROM --platform="linux/${TARGETARCH}" alpine:latest AS base-plus-dash
LABEL version="3.1"
LABEL org.opencontainers.image.title="base-plus-dash"
LABEL org.opencontainers.image.description="Custom Alpine image with the dash shell installed."
LABEL org.opencontainers.image.vendor="individual"
LABEL org.opencontainers.image.licenses="BSD-2-Clause"
SHELL [ "/bin/sh", "-c" ]
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked --network=default \
apk update \
&& apk add cmd:dash
SHELL [ "/usr/bin/dash", "-l", "-c" ]
ENTRYPOINT ["/usr/bin/dash"]
ENV DASH='/usr/bin/dash'
ENV HOSTNAME="base-plus-dash"
# default to double login
CMD [ "/usr/bin/dash", "-l", "-c", "'exec -a dash /usr/bin/dash -il'" ]
FROM --platform="linux/${TARGETARCH}" base-plus-dash as featherhash-bellows
RUN mkdir -p /FeatherHash/FeatherHash && \
mkdir -p /FeatherHash/tests
# Install necessary dependencies and build tools
RUN apk update && \
apk add --no-cache \
clang \
llvm \
cmd:lld
# Copy the project files into the container
COPY build-featherHash.sh /FeatherHash/build-featherHash.sh
COPY FeatherHash/* /FeatherHash/FeatherHash/
COPY LICENSE /FeatherHash/LICENSE
COPY LICENSE /FeatherHash/.PATENT-NOTE-6829355
# Set the working directory inside the container
WORKDIR /FeatherHash
# Build the project using the provided build script
RUN chmod +x build-featherHash.sh && \
dash ./build-featherHash.sh
# Install necessary testing tools
RUN apk update && \
apk add --no-cache \
openssl
COPY tests/* /FeatherHash/tests/
# Make the test runner script executable
RUN chmod +x tests/test_*.sh
# Run the tests
RUN dash ./tests/test_runner.sh
# Set the entry point to run the compiled binary
ENTRYPOINT ["./out/bin/sha256sum"]
# Stage 2: Create the final image
# shellcheck disable=SC2154
FROM --platform="linux/${TARGETARCH}" scratch AS featherhash-shasum
# set inherited values
LABEL version="1.1"
LABEL org.opencontainers.image.title="FeatherHash-shasum"
LABEL org.opencontainers.image.description="Empty image with stage0 sha256sum, sha384sum, and sha512sum installed"
LABEL org.opencontainers.image.vendor="individual"
LABEL org.opencontainers.image.licenses="0BSD"
COPY --from=featherhash-bellows /FeatherHash/out/bin /bin
COPY --from=featherhash-bellows /FeatherHash/LICENSE /LICENSE
COPY --from=featherhash-bellows /FeatherHash/.PATENT-NOTE-6829355 /.PATENT-NOTE-6829355
ENTRYPOINT ["/bin/sha256sum"]