From b04f6965876be9f991746db1b0214c1e490df4cf Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Sun, 28 Jan 2024 16:47:33 +0530 Subject: [PATCH] dockerfile attempts v2 --- Dockerfile-a2 | 37 +++++++++++++++++++++++++++++++++++++ Dockerfile-a3 | 33 +++++++++++++++++++++++++++++++++ Dockerfile-a4 | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 Dockerfile-a2 create mode 100644 Dockerfile-a3 create mode 100644 Dockerfile-a4 diff --git a/Dockerfile-a2 b/Dockerfile-a2 new file mode 100644 index 0000000..929b02a --- /dev/null +++ b/Dockerfile-a2 @@ -0,0 +1,37 @@ +# First stage: Install packages +FROM alpine:3.18 as builder + +RUN apk add --no-cache \ + bash \ + gawk \ + findutils \ + coreutils \ + git \ + ncurses \ + fzf + +# Copy only the ugit script into the container at /app +WORKDIR /app +COPY ugit . + +# Set permissions and move the script to path +RUN chmod +x ugit && mv ugit /usr/local/bin/ + +# Second stage: Copy only necessary binaries and their dependencies +FROM alpine:3.18 + +COPY --from=builder /usr/local/bin/ugit /usr/bin/ +COPY --from=builder /usr/bin/git /usr/bin/ +COPY --from=builder /usr/bin/fzf /usr/bin/ +COPY --from=builder /usr/bin/tput /usr/bin/ +COPY --from=builder /usr/bin/cut /usr/bin/ +COPY --from=builder /usr/bin/tr /usr/bin/ +COPY --from=builder /usr/bin/nl /usr/bin/ +COPY --from=builder /usr/bin/gawk /usr/bin/ +COPY --from=builder /usr/bin/xargs /usr/bin +COPY --from=builder /usr/bin/env /bin/ +COPY --from=builder /bin/bash /bin/ + +WORKDIR /app +# Run ugit when the container launches +CMD ["ugit"] \ No newline at end of file diff --git a/Dockerfile-a3 b/Dockerfile-a3 new file mode 100644 index 0000000..512e1aa --- /dev/null +++ b/Dockerfile-a3 @@ -0,0 +1,33 @@ +# First stage: Install packages +FROM alpine:3.18 as builder + +RUN apk add --no-cache \ + bash \ + coreutils \ + git \ + ncurses \ + fzf + +# Copy only the ugit script into the container at /app +WORKDIR /app +COPY ugit . + +# Set permissions and move the script to path +RUN chmod +x ugit && mv ugit /usr/local/bin/ + +# Second stage: Copy only necessary binaries and their dependencies +FROM alpine:3.18 + +COPY --from=builder /usr/local/bin/ugit /usr/bin/ +COPY --from=builder /usr/bin/git /usr/bin/ +COPY --from=builder /usr/bin/fzf /usr/bin/ +COPY --from=builder /usr/bin/tput /usr/bin/ +COPY --from=builder /usr/bin/cut /usr/bin/ +COPY --from=builder /usr/bin/tr /usr/bin/ +COPY --from=builder /usr/bin/nl /usr/bin/ +COPY --from=builder /usr/bin/env /bin/ +COPY --from=builder /bin/bash /bin/ + +WORKDIR /app +# Run ugit when the container launches +CMD ["ugit"] \ No newline at end of file diff --git a/Dockerfile-a4 b/Dockerfile-a4 new file mode 100644 index 0000000..52cadb5 --- /dev/null +++ b/Dockerfile-a4 @@ -0,0 +1,32 @@ +# First stage: Install packages +FROM alpine:3.18 as builder + +RUN apk add --no-cache \ + bash \ + coreutils \ + git \ + ncurses \ + fzf + +# Copy only the ugit script into the container at /app +COPY ugit . + +# Set permissions and move the script to path +RUN chmod +x ugit && mv ugit /usr/local/bin/ + +# Second stage: Copy only necessary binaries and their dependencies +FROM scratch + +COPY --from=builder /usr/local/bin/ugit /usr/bin/ +COPY --from=builder /usr/bin/git /usr/bin/ +COPY --from=builder /usr/bin/fzf /usr/bin/ +COPY --from=builder /usr/bin/tput /usr/bin/ +COPY --from=builder /usr/bin/cut /usr/bin/ +COPY --from=builder /usr/bin/tr /usr/bin/ +COPY --from=builder /usr/bin/nl /usr/bin/ +COPY --from=builder /usr/bin/env /bin/ +COPY --from=builder /bin/bash /bin/ + +WORKDIR /app +# Run ugit when the container launches +CMD ["ugit"] \ No newline at end of file