docker image improvements
Operations on creating, pulling, pushing, running docker containers are slow. Here are some ways they can improve.
-
Instead of installing required dependency packages each time, have an a priori prepared image that you start from that has all the dependencies installed. -
Use the builder pattern in docker to separate build dependencies from the artefacts that are strictly required to run. This should greatly reduce the footprint of the image. It would look something like this in the dockerfile:
# Builder:
FROM image:version AS builder
RUN apt-get install ...
RUN go build ...
# Worker:
FROM image:version
COPY --from=builder /usr/bin/stork-server /usr/bin/stork-server
CMD /usr/bin/stork-server
-
Replace the few sleep 15
commands with proper waiting of the dependency services to start up.