go-scim icon indicating copy to clipboard operation
go-scim copied to clipboard

Docker build does not use cache for dependency downloading

Open aliotta opened this issue 4 years ago • 1 comments

The way the dockerfile is currently written doesn't leverage caching because the download deps step is run in the same context as the build binary step. Using the below dockerfile will improve dev experience.

` ##########################################################################

GO BUILDER

########################################################################## FROM golang:1.13-buster AS builder

WORKDIR /build/scim COPY go.mod ./ COPY pkg/v2/go.mod ./pkg/v2/go.mod COPY mongo/v2/go.mod ./mongo/v2/go.mod COPY Makefile ./ RUN make deps

COPY . ./ RUN make binary

##########################################################################

FINAL IMAGE

########################################################################## FROM debian:buster-slim

copy binary

COPY --from=builder /build/scim/bin/linux_amd64/scim /usr/bin/scim

copy public files

COPY --from=builder /build/scim/public /usr/share/scim/public

run

CMD ["/usr/bin/scim"] `

aliotta avatar Jun 16 '21 20:06 aliotta

Good point @aliotta. I will make sure to incorporate this change into the next release. It may take a while, as I am still recovering from hospital. If you are up for it, feel free to create a PR.

imulab avatar Jun 17 '21 11:06 imulab