dockerfile attempts v1

This commit is contained in:
Bhupesh-V 2024-01-28 14:06:57 +05:30
parent 32b191786d
commit b0a67eb9af
3 changed files with 97 additions and 0 deletions

35
Dockerfile-a2 Normal file
View file

@ -0,0 +1,35 @@
# First stage: Install packages
FROM alpine:3.18 as builder
RUN apk add --no-cache \
bash \
gawk \
findutils \
coreutils \
git \
ncurses \
fzf
COPY ugit .
# Set permissions and move the script to path
RUN chmod +x ugit && mv ugit /usr/bin/
# Second stage: Copy only necessary binaries and their dependencies
FROM busybox
COPY --from=builder /usr/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 ["busybox", "sh", "-c", "/usr/bin/ugit"]

31
Dockerfile-a3 Normal file
View file

@ -0,0 +1,31 @@
# First stage: Install packages
FROM alpine:3.18 as builder
RUN apk add --no-cache \
bash \
coreutils \
git \
ncurses \
fzf
COPY ugit .
# Set permissions and move the script to path
RUN chmod +x ugit && mv ugit /usr/bin/
# Second stage: Copy only necessary binaries and their dependencies
FROM busybox
COPY --from=builder /usr/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"]

31
Dockerfile-a4 Normal file
View file

@ -0,0 +1,31 @@
# First stage: Install packages
FROM alpine:3.18 as builder
RUN apk add --no-cache \
bash \
coreutils \
git \
ncurses \
fzf
COPY ugit .
# Set permissions and move the script to path
RUN chmod +x ugit && mv ugit /usr/bin/
# Second stage: Copy only necessary binaries and their dependencies
FROM scratch
COPY --from=builder /usr/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"]