2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-05 00:00:14 +00:00

Dockerfile: split into two stages

This shrinks resulting image size. On my amd64 system it went from
1.01 GB to 25.1 MB.
This commit is contained in:
Maciej Wereski 2021-01-27 17:51:57 +01:00
parent c90f46ab7e
commit 0e6ba17163

View File

@ -1,4 +1,4 @@
FROM golang:1.15
FROM golang:1.15 as build
RUN mkdir /app
WORKDIR /app
@ -6,8 +6,12 @@ ARG VERSION
ADD . /app/
RUN go build -ldflags=-s -ldflags=-w -ldflags=-X=github.com/miguelmota/cointop/cointop.version=$VERSION -o main .
RUN mv main /bin/cointop
RUN git clone https://github.com/cointop-sh/colors ~/.config/cointop/colors
RUN git clone https://github.com/cointop-sh/colors && rm -Rf colors/.git*
FROM busybox:glibc
RUN mkdir -p /etc/ssl
COPY --from=build /etc/ssl/certs/ /etc/ssl/certs
COPY --from=build /app/main /bin/cointop
COPY --from=build /app/colors /root/.config/cointop/colors
ENTRYPOINT cointop
CMD []